| 1 | # $Id: makefile 262 2004-10-24 22:02:36Z pr $ | 
|---|
| 2 |  | 
|---|
| 3 | # | 
|---|
| 4 | # makefile: | 
|---|
| 5 | #       makefile for src/helpers directory. | 
|---|
| 6 | #       For use with IBM NMAKE, which comes with the IBM compilers, | 
|---|
| 7 | #       the Developer's Toolkit, and the DDK. | 
|---|
| 8 | # | 
|---|
| 9 | #       This makefile is even more complicated than the other makefiles | 
|---|
| 10 | #       because the helpers code has been designed to be independent | 
|---|
| 11 | #       of any single project. For example, the helpers code is used | 
|---|
| 12 | #       by XWorkplace also. As a result, I had to design a way so that | 
|---|
| 13 | #       this makefile can produce output in a variable directory, with | 
|---|
| 14 | #       variable compiler flags, and so on. This is done via environment | 
|---|
| 15 | #       variables (see below). | 
|---|
| 16 | # | 
|---|
| 17 | #       Even worse, with V0.9.5, I chose to create a shared runtime DLL | 
|---|
| 18 | #       for the various WarpIN executables. For that, I chose to use | 
|---|
| 19 | #       a separate makefile (makefile_dll). In order to share make | 
|---|
| 20 | #       definitions, these have been put into separate .in files in | 
|---|
| 21 | #       this directory, which are included via nmake !include. | 
|---|
| 22 | # | 
|---|
| 23 | #       Called from:    main makefile | 
|---|
| 24 | # | 
|---|
| 25 | #       Required environment variables: | 
|---|
| 26 | # | 
|---|
| 27 | #               -- PROJECT_BASE_DIR: where to find setup.in; this should | 
|---|
| 28 | #                   be the root directory of the project, e.g. "C:\cvs\warpin" | 
|---|
| 29 | #                   or "C:\cvs\xworkplace" | 
|---|
| 30 | # | 
|---|
| 31 | #               -- HELPERS_OUTPUT_DIR: where to create output files (*.obj, helpers.lib) | 
|---|
| 32 | #                   this should be a "bin" directory (e.g. "C:\cvs\warpin\bin" | 
|---|
| 33 | # | 
|---|
| 34 | #               -- CC_HELPERS: compiler command line for compiling C files. | 
|---|
| 35 | #                   With VAC++, this should include the /Ge+ (compile to EXE) | 
|---|
| 36 | #                   option to allow linking the library to both EXE and DLL | 
|---|
| 37 | #                   files. | 
|---|
| 38 | #                   If you're using the "dll" target, specify /Ge- instead. | 
|---|
| 39 | # | 
|---|
| 40 | #               -- MAINMAKERUNNING: if this is NOT defined, this makefile | 
|---|
| 41 | #                   will recurse to the makefile in $(PROJECT_BASE_DIR). | 
|---|
| 42 | #                   So to have this makefile run successfully, define this | 
|---|
| 43 | #                   variable to something. | 
|---|
| 44 | # | 
|---|
| 45 | #                   This variable was introduced to be able to start a build | 
|---|
| 46 | #                   process from src\helpers as well. However, when your own | 
|---|
| 47 | #                   project makefile calls src\helpers\makefile, you must set | 
|---|
| 48 | #                   this to something. | 
|---|
| 49 | # | 
|---|
| 50 | #       Input:          ./*.c | 
|---|
| 51 | # | 
|---|
| 52 | #       Targets:        specify the target(s) to be made, which can be: | 
|---|
| 53 | # | 
|---|
| 54 | #                       --  "all" (default): create helpers.lib in addition | 
|---|
| 55 | #                           to all the output .obj files in $(HELPERS_OUTPUT_DIR). | 
|---|
| 56 | # | 
|---|
| 57 | #                           This contains all helpers (plain C, control program, | 
|---|
| 58 | #                           and PM). | 
|---|
| 59 | # | 
|---|
| 60 | #                           This makes linking a bit easier since you don't have to | 
|---|
| 61 | #                           keep in mind the millions of object files. Still, you | 
|---|
| 62 | #                           should be sure to include the proper headers in your | 
|---|
| 63 | #                           code. | 
|---|
| 64 | # | 
|---|
| 65 | #                           Alternatively, you can call this makefile with certain | 
|---|
| 66 | #                           targets explicitly specified. However, you must then | 
|---|
| 67 | #                           make sure that the resulted object files are linked | 
|---|
| 68 | #                           properly, because some of the more advanced helpers | 
|---|
| 69 | #                           require other helpers. | 
|---|
| 70 | # | 
|---|
| 71 | #                       --  "plainc": create "plainc.lib", which contains | 
|---|
| 72 | #                           platform-independent helpers code only (no control | 
|---|
| 73 | #                           program helpers, no PM helpers). | 
|---|
| 74 | # | 
|---|
| 75 | #                           This is included if you specify "all". Use this if | 
|---|
| 76 | #                           you want a subset of the helpers only. | 
|---|
| 77 | # | 
|---|
| 78 | #                       --  "cp": create "cp.lib", which contains "plainc" plus | 
|---|
| 79 | #                           control program helpers. | 
|---|
| 80 | # | 
|---|
| 81 | #                           This is included if you specify "all". Use this if | 
|---|
| 82 | #                           you want a subset of the helpers only. | 
|---|
| 83 | # | 
|---|
| 84 | #       Edit "setup.in" to set up the make process. | 
|---|
| 85 | # | 
|---|
| 86 |  | 
|---|
| 87 | # Say hello to yourself. | 
|---|
| 88 | !if [@echo +++++ Entering $(MAKEDIR)\makefile] | 
|---|
| 89 | !endif | 
|---|
| 90 |  | 
|---|
| 91 | # helpers_pre.in: sets up more environment variables | 
|---|
| 92 | # and defines $(OBJ), which contains all object targets | 
|---|
| 93 | !include helpers_pre.in | 
|---|
| 94 |  | 
|---|
| 95 | # The main target: | 
|---|
| 96 | # If we're called from the main makefile, MAINMAKERUNNING is defined, | 
|---|
| 97 | # and we'll set $(OBJS) as our targets (which will go on). | 
|---|
| 98 | # Otherwise, we call the main makefile, which will again call ourselves later. | 
|---|
| 99 |  | 
|---|
| 100 | all:   \ | 
|---|
| 101 | !ifndef MAINMAKERUNNING | 
|---|
| 102 | callmainmake | 
|---|
| 103 | @echo ----- Leaving $(MAKEDIR) | 
|---|
| 104 | !else | 
|---|
| 105 | $(OUTPUTDIR)\helpers.lib | 
|---|
| 106 | #$(OBJS) | 
|---|
| 107 | @echo ----- Leaving $(MAKEDIR) | 
|---|
| 108 | !endif | 
|---|
| 109 |  | 
|---|
| 110 | plainc:   \ | 
|---|
| 111 | !ifndef MAINMAKERUNNING | 
|---|
| 112 | callmainmake | 
|---|
| 113 | @echo ----- Leaving $(MAKEDIR) | 
|---|
| 114 | !else | 
|---|
| 115 | $(OUTPUTDIR)\plainc.lib | 
|---|
| 116 | #$(OBJS) | 
|---|
| 117 | @echo ----- Leaving $(MAKEDIR) | 
|---|
| 118 | !endif | 
|---|
| 119 |  | 
|---|
| 120 | cp:   \ | 
|---|
| 121 | !ifndef MAINMAKERUNNING | 
|---|
| 122 | callmainmake | 
|---|
| 123 | @echo ----- Leaving $(MAKEDIR) | 
|---|
| 124 | !else | 
|---|
| 125 | $(OUTPUTDIR)\cp.lib | 
|---|
| 126 | #$(OBJS) | 
|---|
| 127 | @echo ----- Leaving $(MAKEDIR) | 
|---|
| 128 | !endif | 
|---|
| 129 |  | 
|---|
| 130 |  | 
|---|
| 131 | callmainmake: | 
|---|
| 132 | @echo $(MAKEDIR)\makefile: Recursing to main makefile. | 
|---|
| 133 | @cd $(PROJECT_BASE_DIR) | 
|---|
| 134 | @nmake | 
|---|
| 135 | @echo $(MAKEDIR)\makefile: Returned from main makefile. Done. | 
|---|
| 136 |  | 
|---|
| 137 | # The "dep" target: run fastdep on the sources. | 
|---|
| 138 | # "nmake dep" gets called from src\makefile if nmake dep | 
|---|
| 139 | # is running on the main makefile. | 
|---|
| 140 | dep: | 
|---|
| 141 | $(RUN_FASTDEP) *.c | 
|---|
| 142 | @echo ----- Leaving $(MAKEDIR) | 
|---|
| 143 |  | 
|---|
| 144 | # Define the main dependency between the output HELPERS.LIB and | 
|---|
| 145 | # all the object files. | 
|---|
| 146 | # $? represents the names of all dependent files that are | 
|---|
| 147 | # out-of-date with respect to the target file. | 
|---|
| 148 | # The exclamation point ( ! ) preceding the LIB command causes NMAKE | 
|---|
| 149 | # to execute the LIB command once for each dependent file in the list. | 
|---|
| 150 |  | 
|---|
| 151 | $(OUTPUTDIR)\helpers.lib: $(OBJS) makefile | 
|---|
| 152 | !ifdef EMX | 
|---|
| 153 | !emxomfar cr $* $? | 
|---|
| 154 | !else | 
|---|
| 155 | - del $@ | 
|---|
| 156 | ilib /nol /nob $@ @<<$(TEMP)\ilib.lnk | 
|---|
| 157 | +$(OBJS: =&^ | 
|---|
| 158 | ); | 
|---|
| 159 | << | 
|---|
| 160 | !endif | 
|---|
| 161 |  | 
|---|
| 162 | # same thing for cp.lib | 
|---|
| 163 | $(OUTPUTDIR)\cp.lib: $(CPOBJS) makefile | 
|---|
| 164 | !ifdef EMX | 
|---|
| 165 | !emxomfar cr $* $? | 
|---|
| 166 | !else | 
|---|
| 167 | - del $@ | 
|---|
| 168 | ilib /nol /nob $@ @<< | 
|---|
| 169 | +$(CPOBJS: =&^ | 
|---|
| 170 | ); | 
|---|
| 171 | << | 
|---|
| 172 | !endif | 
|---|
| 173 |  | 
|---|
| 174 | # same thing for plainc.lib | 
|---|
| 175 | $(OUTPUTDIR)\plainc.lib: $(PLAINCOBJS) makefile | 
|---|
| 176 | !ifdef EMX | 
|---|
| 177 | !emxomfar cr $* $? | 
|---|
| 178 | !else | 
|---|
| 179 | - del $@ | 
|---|
| 180 | ilib /nol /nob $@ @<< | 
|---|
| 181 | +$(PLAINCOBJS: =&^ | 
|---|
| 182 | ); | 
|---|
| 183 | << | 
|---|
| 184 | !endif | 
|---|
| 185 |  | 
|---|
| 186 | !include helpers_post.in | 
|---|
| 187 |  | 
|---|
| 188 | ################################################### | 
|---|
| 189 | # | 
|---|
| 190 | # "test" target: for test cases | 
|---|
| 191 | # | 
|---|
| 192 | ################################################### | 
|---|
| 193 |  | 
|---|
| 194 | TESTCASE_DIR = testcase | 
|---|
| 195 |  | 
|---|
| 196 | DEBUGDIALOG = | 
|---|
| 197 | !ifdef DBGDLG | 
|---|
| 198 | DEBUGDIALOG = /DDEBUG_DIALOG_WINDOWS=1 | 
|---|
| 199 | !endif | 
|---|
| 200 |  | 
|---|
| 201 | TESTCASE_CC = icc /c /ti+ /w2 /ss /se /D__DEBUG__=1 $(DEBUGDIALOG) /i$(HELPERS_BASE)\include /Fo$(TESTCASE_DIR)\$(@B).obj $(@B).c | 
|---|
| 202 |  | 
|---|
| 203 | .c.{$(TESTCASE_DIR)}.obj: | 
|---|
| 204 | @echo $(MAKEDIR)\makefile: Compiling $(@B).c | 
|---|
| 205 | @echo INCLUDE is $(INCLUDE) | 
|---|
| 206 | $(TESTCASE_CC) | 
|---|
| 207 |  | 
|---|
| 208 | # testcase executables | 
|---|
| 209 | TESTCASE_TARGETS = \ | 
|---|
| 210 | dosh.exe \ | 
|---|
| 211 | dialog.exe \ | 
|---|
| 212 | exeh.exe \ | 
|---|
| 213 | fdlg.exe \ | 
|---|
| 214 | xmap.exe \ | 
|---|
| 215 | vcard.exe | 
|---|
| 216 |  | 
|---|
| 217 | # dialog.exe | 
|---|
| 218 | DIALOG_TEST_OBJS = \ | 
|---|
| 219 | $(TESTCASE_DIR)\dialog.obj \ | 
|---|
| 220 | $(TESTCASE_DIR)\_test_dialog.obj \ | 
|---|
| 221 | $(TESTCASE_DIR)\winh.obj \ | 
|---|
| 222 | $(TESTCASE_DIR)\xstring.obj \ | 
|---|
| 223 | $(TESTCASE_DIR)\linklist.obj \ | 
|---|
| 224 | $(TESTCASE_DIR)\cctl_checkcnr.obj \ | 
|---|
| 225 | $(TESTCASE_DIR)\cnrh.obj \ | 
|---|
| 226 | $(TESTCASE_DIR)\comctl.obj \ | 
|---|
| 227 | $(TESTCASE_DIR)\stringh.obj \ | 
|---|
| 228 | $(TESTCASE_DIR)\dosh.obj \ | 
|---|
| 229 | $(TESTCASE_DIR)\except.obj \ | 
|---|
| 230 | $(TESTCASE_DIR)\debug.obj \ | 
|---|
| 231 | $(TESTCASE_DIR)\textview.obj \ | 
|---|
| 232 | $(TESTCASE_DIR)\textv_html.obj \ | 
|---|
| 233 | $(TESTCASE_DIR)\tmsgfile.obj \ | 
|---|
| 234 | $(TESTCASE_DIR)\datetime.obj \ | 
|---|
| 235 | $(TESTCASE_DIR)\tree.obj \ | 
|---|
| 236 | $(TESTCASE_DIR)\gpih.obj | 
|---|
| 237 |  | 
|---|
| 238 | $(TESTCASE_DIR)\dialog.obj: ..\..\include\helpers\dialog.h | 
|---|
| 239 | $(TESTCASE_DIR)\_test_dialog.obj: ..\..\include\helpers\dialog.h | 
|---|
| 240 |  | 
|---|
| 241 | dialog.exe: $(DIALOG_TEST_OBJS) | 
|---|
| 242 | ilink /debug /optfunc /pmtype:pm $(DIALOG_TEST_OBJS) pmprintf.lib /o:$@ | 
|---|
| 243 |  | 
|---|
| 244 | # dosh.exe | 
|---|
| 245 | DOSH_TEST_OBJS = \ | 
|---|
| 246 | $(TESTCASE_DIR)\dosh.obj \ | 
|---|
| 247 | $(TESTCASE_DIR)\_test_dosh.obj | 
|---|
| 248 |  | 
|---|
| 249 | dosh.exe: $(DOSH_TEST_OBJS) | 
|---|
| 250 | ilink /debug /optfunc /pmtype:vio $(DOSH_TEST_OBJS) pmprintf.lib /o:$@ | 
|---|
| 251 |  | 
|---|
| 252 | # exeh.exe | 
|---|
| 253 | EXEH_TEST_OBJS = \ | 
|---|
| 254 | $(TESTCASE_DIR)\dosh.obj \ | 
|---|
| 255 | $(TESTCASE_DIR)\exeh.obj \ | 
|---|
| 256 | $(TESTCASE_DIR)\stringh.obj \ | 
|---|
| 257 | $(TESTCASE_DIR)\xstring.obj \ | 
|---|
| 258 | $(TESTCASE_DIR)\_test_exeh.obj | 
|---|
| 259 |  | 
|---|
| 260 | exeh.exe: $(EXEH_TEST_OBJS) | 
|---|
| 261 | ilink /debug /optfunc /pmtype:vio $(EXEH_TEST_OBJS) pmprintf.lib /o:$@ | 
|---|
| 262 |  | 
|---|
| 263 | # fdlg.exe | 
|---|
| 264 | FDLG_TEST_OBJS = \ | 
|---|
| 265 | $(TESTCASE_DIR)\dosh.obj \ | 
|---|
| 266 | $(TESTCASE_DIR)\gpih.obj \ | 
|---|
| 267 | $(TESTCASE_DIR)\winh.obj \ | 
|---|
| 268 | $(TESTCASE_DIR)\stringh.obj \ | 
|---|
| 269 | $(TESTCASE_DIR)\xstring.obj \ | 
|---|
| 270 | $(TESTCASE_DIR)\_call_filedlg.obj | 
|---|
| 271 |  | 
|---|
| 272 | fdlg.exe: $(FDLG_TEST_OBJS) | 
|---|
| 273 | ilink /debug /pmtype:pm $(FDLG_TEST_OBJS) /o:$@ | 
|---|
| 274 |  | 
|---|
| 275 | # xmap.exe | 
|---|
| 276 | MAP_TEST_OBJS = \ | 
|---|
| 277 | $(TESTCASE_DIR)\map_vac.obj \ | 
|---|
| 278 | $(TESTCASE_DIR)\linklist.obj \ | 
|---|
| 279 | $(TESTCASE_DIR)\stringh.obj \ | 
|---|
| 280 | $(TESTCASE_DIR)\xstring.obj \ | 
|---|
| 281 | $(TESTCASE_DIR)\_test_map.obj | 
|---|
| 282 |  | 
|---|
| 283 | xmap.exe: $(MAP_TEST_OBJS) | 
|---|
| 284 | ilink /debug /optfunc /pmtype:vio $(MAP_TEST_OBJS) pmprintf.lib /o:$@ | 
|---|
| 285 |  | 
|---|
| 286 | # vcard.exe | 
|---|
| 287 | VCARD_TEST_OBJS = \ | 
|---|
| 288 | $(TESTCASE_DIR)\vcard.obj \ | 
|---|
| 289 | $(TESTCASE_DIR)\_test_vcard.obj \ | 
|---|
| 290 | $(TESTCASE_DIR)\xstring.obj \ | 
|---|
| 291 | $(TESTCASE_DIR)\stringh.obj \ | 
|---|
| 292 | $(TESTCASE_DIR)\linklist.obj \ | 
|---|
| 293 | $(TESTCASE_DIR)\dosh.obj \ | 
|---|
| 294 | $(TESTCASE_DIR)\prfh.obj \ | 
|---|
| 295 | $(TESTCASE_DIR)\nls.obj \ | 
|---|
| 296 | $(TESTCASE_DIR)\except.obj \ | 
|---|
| 297 | $(TESTCASE_DIR)\debug.obj \ | 
|---|
| 298 | $(TESTCASE_DIR)\tree.obj | 
|---|
| 299 |  | 
|---|
| 300 | vcard.exe: $(VCARD_TEST_OBJS) | 
|---|
| 301 | ilink /debug /pmtype:vio $(VCARD_TEST_OBJS) /o:$@ | 
|---|
| 302 |  | 
|---|
| 303 | test: $(TESTCASE_TARGETS) | 
|---|
| 304 |  | 
|---|
| 305 |  | 
|---|