Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Porting gnu makefile from Borland compiler and TASM to Intel compiler

pjsallday
Beginner
535 Views
I currently have a project that uses all the tools from the borland suite(compiler, assembler). Linkloc.exe is used to link the files and I need to use a GNU makefile structure and implement the intel compiler. All files being compiled are .c or .asm files. I have few questions.

1.Does anyone know where there is a tutorial on how this can be done or an example of it being done?

2.Currently TASM is called to assemble .asm files. How is this done in the intel compiler? What is the equivalent?

3. Here is an example of some the things I need help withconvertingin the makefile:

# Directories for Linkers, compilers, assemblers
#
BORLAND_TOOLS_VOLUME := D:
TOPLEVEL := ..
TOOLSDIR := $(TOPLEVEL)\\Tools
BCC_INCLUDE := $(BORLAND_TOOLS_VOLUME)\\bc5\\include
BORLAND_TOOLS := $(BORLAND_TOOLS_VOLUME)\\bc5\\bin
TASM_BASE := $(BORLAND_TOOLS_VOLUME)\\tasm\\bin


#include config.mak
#

COMPILER_DEBUG_FLAG := -v -B -Tla
TASM_DEBUG_FLAG := /zi /la

BCC32 := $(BORLAND_TOOLS)\\Bcc32 -w -Od -R $(COMPILER_DEBUG_FLAG) -D$(MODULE_SW) -vi -x- -xd- -RT- -WC -g200
TASM32 := $(TASM_BASE)\\Tasm32 /m /ml $(TASM_DEBUG_FLAG)
EMBED := $(TOOLSDIR)\\embed\\embed
LINKER_EXE := $(TOOLSDIR)\\linkloc\\linkloc
SPLIT := $(TOOLSDIR)\\splitter\\splitter
PADUTIL := $(TOOLSDIR)\\padboot\\padboot

#include rules.mak
#

%.obj : %.c
$(BCC32) -I$(INCLUDE_SEARCH) -c p2init.obj : p2init.asm
$(TASM32) tiny_mce_markerlt; $@

p2cache.obj : p2cache.asm
$(TASM32) tiny_mce_markerlt; $@

p3init.obj : p3init.asm

These are examples of how the makefile is structured and how I need to implement the Intel compiler. Thank you very much for taking the time to read this. Any help or suggestions would be greatly appreciated.
$(TASM32) tiny_mce_markerlt; $@
lt; -o$@

%.obj : %.asm
$(BCC32) -I$(INCLUDE_SEARCH) -c p2init.obj : p2init.asm
$(TASM32) tiny_mce_markerlt; $@

p2cache.obj : p2cache.asm
$(TASM32) tiny_mce_markerlt; $@

p3init.obj : p3init.asm
$(TASM32) tiny_mce_markerlt; $@
lt; -o$@


p2init.obj : p2init.asm
$(TASM32) tiny_mce_markerlt; $@

p2cache.obj : p2cache.asm
$(TASM32) tiny_mce_markerlt; $@

p3init.obj : p3init.asm
$(TASM32) tiny_mce_markerlt; $@


0 Kudos
3 Replies
TimP
Honored Contributor III
535 Views
I'll guess that you mean to stick with Windows, as there are plenty of gnu make tutorials for linux.
You could pass asm source files through icl, which in turn would run a Visual Studio assembler; icl itself doesn't process .asm. I have no idea how compatible your current assembler might be.
You can use icl for link (possibly filling in the Microsoft linker path in icl.cfg, in case you have more than one link installed), or you could use the Visual Studio link path.
Your scheme for the makefile (with all compile flags attached to the compile command) is somewhat unusual, but should work with direct substitutions. Tastes vary as to whether to write the path to a specific version of the compiler in the Makefile, or open up the cmd prompt window and simply call the compiler icl in the Makefile.
I'm not familiar with your '%' and ';' notations in standard Makefile or gnu make, but that doesn't change for gnu make between Windows and any other platform. I would have thought that ; would be used, if at all, to string multiple actions together. Only the file suffixes change and aren't dealt with by defaults.
It looks like you intend not to rename .obj files to .o, but you can go either way.
0 Kudos
TimP
Honored Contributor III
535 Views
No poster's delete button today.
0 Kudos
pjsallday
Beginner
535 Views
The % is pattern matching for all the .C to the .obj files. So for every .c there coresponds the same prefix to the .obj.

So I would replace the bcc32 call with the icl call and find the corresponding flags from borland to intel? TASM32 could also be replaced with icl as well? So in short icl would handle assembling and compiling for me? Thanks for your help
0 Kudos
Reply