| 1 | #
|
|---|
| 2 | # Template makefile, to build with 32-bit compiler; many different targets!
|
|---|
| 3 | #
|
|---|
| 4 | # JvW 14-01-2004 Updated for the generic template build environment
|
|---|
| 5 | #
|
|---|
| 6 | # Usage: Include this from a subdirectory with a 'makefile' that set the
|
|---|
| 7 | # various environmental variables like 'target_os' and 'target_env'
|
|---|
| 8 |
|
|---|
| 9 | # define main component name
|
|---|
| 10 | compo = sam6
|
|---|
| 11 |
|
|---|
| 12 | cc = wcc386
|
|---|
| 13 |
|
|---|
| 14 | # allow (> 2 times) faster building by using the DLL versions from wmake
|
|---|
| 15 | !ifdef __LOADDLL__
|
|---|
| 16 | ! loaddll wcc386 wccd386
|
|---|
| 17 | ! loaddll wlink wlink
|
|---|
| 18 | ! loaddll wlib wlibd
|
|---|
| 19 | !endif
|
|---|
| 20 |
|
|---|
| 21 | !ifndef tx_version
|
|---|
| 22 | tx_version = _txall_
|
|---|
| 23 | !endif
|
|---|
| 24 | !ifneq tx_version _txall_
|
|---|
| 25 | cflags += -DTXMIN
|
|---|
| 26 | !endif
|
|---|
| 27 |
|
|---|
| 28 | txdir = ..\..\..\txlib\$(tx_version)\lib
|
|---|
| 29 | txinc = ..\..\..\txlib\include
|
|---|
| 30 |
|
|---|
| 31 | cflags += -bt=$(target_os) -ef -wx -zc -zp1 -zq
|
|---|
| 32 | lnkopt += option map option stack=128K libpath $(txdir)
|
|---|
| 33 | postfix =
|
|---|
| 34 | comprs = rem
|
|---|
| 35 |
|
|---|
| 36 | !ifeq target_env debug
|
|---|
| 37 | cflags += -d2
|
|---|
| 38 | #activate next line to remove trace from debug EXE (update txlib makefile too)
|
|---|
| 39 | #cflags += -DNOTRACE
|
|---|
| 40 | lnkopt += debug all
|
|---|
| 41 | postfix = d
|
|---|
| 42 | !else
|
|---|
| 43 | !ifeq target_env trace
|
|---|
| 44 | postfix = t
|
|---|
| 45 | !else
|
|---|
| 46 | postfix = r
|
|---|
| 47 | #activate next line to remove ALL trace from EXE (not just from TXLIB)
|
|---|
| 48 | cflags += -DNOTRACE
|
|---|
| 49 | !endif
|
|---|
| 50 | #select optimization for the non-debug (t and r) versions
|
|---|
| 51 | cflags += -ormile
|
|---|
| 52 | !endif
|
|---|
| 53 |
|
|---|
| 54 | !ifeq target_os nt
|
|---|
| 55 | cflags += -bm -ei
|
|---|
| 56 | lnkopt += libpath $(%wintklib)
|
|---|
| 57 | bintype = win
|
|---|
| 58 | comprs = upx --best
|
|---|
| 59 | !endif
|
|---|
| 60 |
|
|---|
| 61 | !ifeq target_os os2
|
|---|
| 62 | cflags += -bm
|
|---|
| 63 | lnkopt += libpath $(%os2tklib)
|
|---|
| 64 | bintype = os2
|
|---|
| 65 | comprs = lxlite
|
|---|
| 66 | !endif
|
|---|
| 67 |
|
|---|
| 68 | !ifeq target_os linux
|
|---|
| 69 | lnkopt += libpath $(%lintklib)
|
|---|
| 70 | bintype = lin
|
|---|
| 71 | comprs = upx --best
|
|---|
| 72 | !endif
|
|---|
| 73 |
|
|---|
| 74 | !ifeq target_os dos
|
|---|
| 75 | !ifeq target_sys dos32a
|
|---|
| 76 | bintype = dos
|
|---|
| 77 | !else
|
|---|
| 78 | bintype = dcw
|
|---|
| 79 | !endif
|
|---|
| 80 | comprs = upx --best
|
|---|
| 81 | !endif
|
|---|
| 82 |
|
|---|
| 83 | gendep = makefile ..\..\makefile.mif
|
|---|
| 84 |
|
|---|
| 85 | .EXTENSIONS:
|
|---|
| 86 | .EXTENSIONS: .exe .lib .obj .c .h
|
|---|
| 87 |
|
|---|
| 88 | .c : ..\..
|
|---|
| 89 | .h : ..\..;$(txinc)
|
|---|
| 90 |
|
|---|
| 91 | .c.obj : .AUTODEPEND $(gendep)
|
|---|
| 92 | $(cc) $[*.c $(cflags)
|
|---|
| 93 |
|
|---|
| 94 | exebase = ..\$(compo)$(bintype)
|
|---|
| 95 | exename = $(exebase)$(postfix).exe
|
|---|
| 96 |
|
|---|
| 97 | all : $(exename) .SYMBOLIC
|
|---|
| 98 |
|
|---|
| 99 | #list all object files to create a full dependancy list for the exe
|
|---|
| 100 | exedeps = &
|
|---|
| 101 | $(compo).obj
|
|---|
| 102 |
|
|---|
| 103 | # add any objects and libraries needed beyond the component itself
|
|---|
| 104 | lnkspec = &
|
|---|
| 105 | name $(exename) &
|
|---|
| 106 | library tx$(bintype)$(postfix).lib &
|
|---|
| 107 | file $(compo)
|
|---|
| 108 |
|
|---|
| 109 | $(exename) : $(exedeps) $(gendep) $(txdir)\tx$(bintype)$(postfix).lib
|
|---|
| 110 | @%create $(compo).lnk
|
|---|
| 111 | @%append $(compo).lnk system $(target_sys) $(lnkopt)
|
|---|
| 112 | @%append $(compo).lnk $(lnkspec)
|
|---|
| 113 | wlink $(lnkopt) @$(compo).lnk
|
|---|
| 114 | !ifeq target_env debug
|
|---|
| 115 | !else
|
|---|
| 116 | - $(comprs) $^@
|
|---|
| 117 | !endif
|
|---|
| 118 |
|
|---|
| 119 | clean : .SYMBOLIC
|
|---|
| 120 | @if exist *.obj del *.obj $(exename)
|
|---|
| 121 | @if exist *.lnk del *.lnk
|
|---|
| 122 | @if exist *.err del *.err
|
|---|
| 123 | @if exist *.map del *.map
|
|---|
| 124 | @if exist *.lst del *.lst
|
|---|