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