home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xwphescr.zip / XWPH0208.ZIP / src / helpers / makefile < prev    next >
Makefile  |  2002-08-11  |  9KB  |  254 lines

  1. # $Id: makefile,v 1.8 2002/08/11 17:07:58 umoeller Exp $
  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. # "test" target: for test cases
  145. TESTCASE_DIR = testcase
  146.  
  147. TESTCASE_CC = icc /c /ti+ /w2 /ss /se /i$(HELPERS_BASE)\include /Fo$(TESTCASE_DIR)\$(@B).obj $(@B).c
  148.  
  149. .c.{$(TESTCASE_DIR)}.obj:
  150.     @echo $(MAKEDIR)\makefile: Compiling $(@B).c
  151.     $(TESTCASE_CC)
  152.  
  153. # testcase executables
  154. TESTCASE_TARGETS = \
  155.     dosh.exe \
  156.     dialog.exe \
  157.     vcard.exe \
  158.     fdlg.exe \
  159.  
  160. # dosh.exe
  161. DOSH_TEST_OBJS = \
  162.     $(TESTCASE_DIR)\dosh.obj \
  163.     $(TESTCASE_DIR)\_test_dosh.obj
  164.  
  165. dosh.exe: $(DOSH_TEST_OBJS)
  166.     ilink /debug /optfunc /pmtype:vio $(DOSH_TEST_OBJS) /o:$@
  167.  
  168. $(TESTCASE_DIR)\dialog.obj: ..\..\include\helpers\dialog.h
  169. $(TESTCASE_DIR)\_test_dialog.obj: ..\..\include\helpers\dialog.h
  170.  
  171. # dialog.exe
  172. DIALOG_TEST_OBJS = \
  173.     $(TESTCASE_DIR)\dialog.obj \
  174.     $(TESTCASE_DIR)\_test_dialog.obj \
  175.     $(TESTCASE_DIR)\winh.obj \
  176.     $(TESTCASE_DIR)\xstring.obj \
  177.     $(TESTCASE_DIR)\linklist.obj \
  178.     $(TESTCASE_DIR)\cctl_checkcnr.obj \
  179.     $(TESTCASE_DIR)\cnrh.obj \
  180.     $(TESTCASE_DIR)\comctl.obj \
  181.     $(TESTCASE_DIR)\stringh.obj \
  182.     $(TESTCASE_DIR)\dosh.obj \
  183.     $(TESTCASE_DIR)\except.obj \
  184.     $(TESTCASE_DIR)\debug.obj \
  185.     $(TESTCASE_DIR)\textview.obj \
  186.     $(TESTCASE_DIR)\textv_html.obj \
  187.     $(TESTCASE_DIR)\tmsgfile.obj \
  188.     $(TESTCASE_DIR)\datetime.obj \
  189.     $(TESTCASE_DIR)\tree.obj \
  190.     $(TESTCASE_DIR)\gpih.obj
  191.  
  192. dialog.exe: $(DIALOG_TEST_OBJS)
  193.     ilink /debug /optfunc /pmtype:pm $(DIALOG_TEST_OBJS) /o:$@
  194.  
  195. # vcard.exe
  196. VCARD_TEST_OBJS = \
  197.     $(TESTCASE_DIR)\vcard.obj \
  198.     $(TESTCASE_DIR)\_test_vcard.obj \
  199.     $(TESTCASE_DIR)\xstring.obj \
  200.     $(TESTCASE_DIR)\stringh.obj \
  201.     $(TESTCASE_DIR)\linklist.obj \
  202.     $(TESTCASE_DIR)\dosh.obj \
  203.     $(TESTCASE_DIR)\prfh.obj \
  204.     $(TESTCASE_DIR)\nls.obj \
  205.     $(TESTCASE_DIR)\except.obj \
  206.     $(TESTCASE_DIR)\debug.obj \
  207.     $(TESTCASE_DIR)\tree.obj
  208.  
  209. vcard.exe: $(VCARD_TEST_OBJS)
  210.     ilink /debug /pmtype:vio $(VCARD_TEST_OBJS) /o:$@
  211.  
  212. # vcard.exe
  213. VCARD_TEST_OBJS = \
  214.     $(TESTCASE_DIR)\_call_filedlg.obj
  215.  
  216. fdlg.exe: $(VCARD_TEST_OBJS)
  217.     ilink /debug /pmtype:pm $(VCARD_TEST_OBJS) /o:$@
  218.  
  219. test: $(TESTCASE_TARGETS)
  220.  
  221. # Define the main dependency between the output HELPERS.LIB and
  222. # all the object files.
  223. # $? represents the names of all dependent files that are
  224. # out-of-date with respect to the target file.
  225. # The exclamation point ( ! ) preceding the LIB command causes NMAKE
  226. # to execute the LIB command once for each dependent file in the list.
  227.  
  228. $(OUTPUTDIR)\helpers.lib: $(OBJS)
  229. !ifdef EMX
  230.     !emxomfar cr $* $?
  231. !else
  232.     !ilib /nol /nob $* -+$?;
  233. !endif
  234.  
  235. # same thing for cp.lib
  236. $(OUTPUTDIR)\cp.lib: $(CPOBJS)
  237. !ifdef EMX
  238.     !emxomfar cr $* $?
  239. !else
  240.     !ilib /nol /nob $* -+$?;
  241. !endif
  242.  
  243. # same thing for plainc.lib
  244. $(OUTPUTDIR)\plainc.lib: $(PLAINCOBJS)
  245. !ifdef EMX
  246.     !emxomfar cr $* $?
  247. !else
  248.     !ilib /nol /nob $* -+$?;
  249. !endif
  250.  
  251. !include helpers_post.in
  252.  
  253.  
  254.