home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: WPS_PM / WPS_PM.zip / xfld085s.zip / main / xfldr.mak < prev    next >
Text File  |  1999-02-08  |  17KB  |  476 lines

  1. #
  2. # Makefile for the XFolder project w/out NLS support.
  3. #
  4. # For use with IBM NMAKE, which is part of IBM C-Set/2 and VisualAge C++.
  5. # This file will probably not work with other MAKE utilities, such as
  6. # GNU make or DMAKE.
  7. #
  8. # I admit that this is a monster makefile, but it's fairly intelligent.
  9. #
  10. #       Copyright (C) 1997-99 Ulrich Möller.
  11. #       This file is part of the XFolder source package.
  12. #       XFolder is free software; you can redistribute it and/or modify
  13. #       it under the terms of the GNU General Public License as published
  14. #       by the Free Software Foundation, in version 2 as it comes in the
  15. #       "COPYING" file of the XFolder main distribution.
  16. #       This program is distributed in the hope that it will be useful,
  17. #       but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. #       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. #       GNU General Public License for more details.
  20. #
  21.  
  22. # VARIABLES
  23. # ---------
  24. # Set up a few environment variables. This is done with
  25. # "macros" (in NMAKE terminology), which are assumed when
  26. # a "=" is encountered.
  27. # You might want to change a few things in this section, notably
  28. # the XFOLDERPATH variable.
  29.  
  30. # The following checks for the environment variable XFOLDERPATH,
  31. # which should be the directory where XFolder is installed.
  32. # The output files will be copied there to.
  33. # This is set by MAKE.CMD, for example.
  34. # If this var is not defined yet, we set a default value (which
  35. # is probably wrong for your system).
  36. !ifndef XFOLDERPATH
  37. XFOLDERPATH=G:\develop\C\XFolder\running
  38. !endif
  39. XFRUNNING = $(XFOLDERPATH)
  40.  
  41. # The following is the directory for precompiled header files.
  42. # This is a feature of VAC++ 3.0 to speed up compilation. If
  43. # the PRECH variable is not defined, precompiled header files
  44. # will not be used. I strongly recommend using a RAM disk for
  45. # this (as for TEMP files in general).
  46. # We create a _separate_ precompiled header file for each
  47. # source file (in the $(PRECH) directory). This eats up a lot
  48. # of disk space, but makes sure that the precompiled header
  49. # does not get recreated for each source file. If you don't
  50. # like this, get rid of it. That's slower though.
  51. # PRECH = $(TEMP)
  52.  
  53. # Define the suffixes for files which NMAKE will work on.
  54. # .SUFFIXES is a reserved NMAKE keyword ("pseudotarget") for
  55. # defining file extensions that NMAKE will recognize in inference
  56. # rules.
  57.  
  58. .SUFFIXES: .c .obj .dll .idl .h .ih .rc .res
  59.  
  60. # HELPERS contains the C helper sources. This is relative to
  61. # /MAIN.
  62. HELPERS = ..\helpers
  63.  
  64. # Some SOM variables. You won't have to change these.
  65. SOMTEMP = $(TEMP)
  66. !if [set SOMTMP=$(TEMP)] || \
  67.     [set SMTMP=$(SOMTEMP)] || \
  68.     [set SMEMIT=ih;h;c] || \
  69.     [set SMADDSTAR=1] || \
  70.     [set SMNOTC=1]
  71. !endif
  72.  
  73. INCLUDE = $(INCLUDE);$(HELPERS);J:/develop/STL
  74. LIB     = $(LIB);..\helpers
  75.  
  76. # Compiler macro. This is used for each .OBJ file to be created.
  77. # If the XFRELEASE environment variable was set to anything, we
  78. # won't use debugging compiler options. This variable is set by
  79. # MAKE.CMD.
  80.  
  81. !ifdef XFRELEASE
  82. CC      = icc /c /gd- /ge- /gi+ /gm+ /q+ /se /ss /o+ /ol- /Tn+ /W2
  83. !else
  84. CC      = icc /c /gd- /ge- /gi+ /gm+ /q+ /se /ss /o- /ol- /Ti+ /Tn+ /W2
  85. !endif
  86.  
  87. # /oi- /w2 /fi+
  88. #/ti+
  89.  
  90. # Some VisualAge C++ compiler options explained:
  91. # /c:   compile only, no link (we'll call the linker explicitly)
  92. # /fi+: precompile header files
  93. # /gd-: link runtime statically
  94. # /ge-: create DLL code
  95. # /gi+: fast integer execution
  96. # /Gl+: remove unreferenced functions (when comp.+link in 1 step)
  97. # /gm+: multithread libraries
  98. # /kc+: produce preprocessor warnings
  99. # /o+:  optimization (inlining etc.)
  100. # /oi-: no inlining (?)
  101. # /ol+: use intermediate linker; do _not_ use with debug code
  102. # /q+:  suppress icc logo
  103. # /Re : don't use subsystem libraries (!= Rn)
  104. # /se:  all language extensions
  105. # /si+: allow use of precompiled header files
  106. # /ss:  allow double slashes comments in C too
  107. # /ti+: debug code
  108. # /tdp: compile everything as C++, even if it has a .C suffix
  109. # /Tn:  add source line numbers to object files (for mapfile)
  110. # /Wcls: class problems
  111. # /Wcnd: conditional exprs problems (= / == etc.)
  112. # /Wcmp: possible unsigned comparison redundancies
  113. # /Wcns: operations involving constants
  114. # /Wcnv: conversions
  115. # /Wcpy: copy constructor problems
  116. # /Wgen: generic debugging msgs
  117. # /Wobs: obsolete features
  118. # /Word: unspecified evaluation order
  119. # /Wpar: list not-referenced parameters (annoying)
  120. # /Wppc: list possible preprocessor problems (.h dependencies)
  121. # /Wpro: warn if funcs have not been prototyped
  122. # /Wrea: mark code that cannot be reached
  123. # /Wret: check consistency of return levels
  124. # /Wuni: uninitialized variables
  125. # /Wuse: unused variables
  126. # /w2:   produce error and warning messages, but no infos
  127.  
  128.  
  129. #
  130. # Link macro. This is used for final linking.
  131. #
  132.  
  133. !ifdef XFRELEASE
  134. LINK =  ilink /noe /map /linenumbers /optfunc /exepack:2
  135. !else
  136. LINK =  ilink /noe /map /linenumbers /debug
  137. !endif
  138.  
  139. # Some LINK386 cmd line options
  140. # (Visual Age ILINK understands these too if /nofree is specified):
  141. # /align:  executable pages align factor (in bytes)
  142. # /noe:    no extended dictionary. Required for replacing _DLL_InitTerm.
  143. # /noi:    no ignore case (necc. for C)
  144. # /map:    list public symbols
  145. # /nod:    no default library search (explicitly specify libs)
  146. # /nol:    no logo (link386 startup)
  147. # /packcode: group neighboring code segments
  148. # /packdata: group neighboring data segments
  149. # /de:     include debug code
  150.  
  151. #
  152. # Resource compiler macro.
  153. #
  154.  
  155. RC      = rc -p -x2
  156.  
  157. # The LIBS macro contains all the .LIB files, either from the compiler or
  158. # others, which are needed for this project:
  159. #   somtk       is the SOM toolkit lib
  160. #   pmprintf    is for debugging (in /HELPERS)
  161. # The other OS/2 libraries are used by default.
  162. LIBS = somtk.lib $(HELPERS)\pmprintf.lib
  163.  
  164. # The OBJS macro contains all the .OBJ files which belong to this project.
  165. OBJS = xfobj.obj xfldr.obj xfdesk.obj xfsys.obj xfdisk.obj xfdataf.obj xfpgmf.obj \
  166.        apm.obj classlst.obj cnrsort.obj common.obj debug.obj except.obj menus.obj module.obj \
  167.        notebook.obj statbars.obj xshutdwn.obj xthreads.obj xwps.obj
  168.  
  169. # The HLPOBJS macro contains all the .OBJ files from the helpers directory.
  170. # These will be created in the /MAIN directory too.
  171. HLPOBJS = animate.obj dosh.obj eas.obj gpih.obj linklist.obj procstat.obj \
  172.           prfh.obj progbars.obj shapewin.obj stringh.obj threads.obj winh.obj wphandle.obj
  173.  
  174. #
  175. # Now define inference rules for what to do with certain file
  176. # types, based on their file extension.
  177. # The syntax we need here is ".fromext.toext".
  178. # So whenever NMAKE encounters a .toext file, it
  179. # executes what we specify here.
  180. #
  181. # Special macros used here: $* is the current target w/out ext.
  182. #
  183.  
  184. # 1) compile C files to .OBJ files, using the CC macro above.
  185.  
  186. .c.obj:
  187.         @ echo Compiling $*.c:
  188. !ifndef PRECH
  189.         $(CC) -I$(INCLUDE) $*.c
  190. !else
  191.         $(CC) /fi"$(PRECH)\$*.pch" /si"$(PRECH)\$*.pch" -I$(INCLUDE) $*.c
  192. !endif
  193.  
  194. # 2) same thing for the source files in /HELPERS; the .OBJ files
  195. #    will be created in /MAIN too.
  196. {$(HELPERS)}.c.obj:
  197.         @ echo Compiling $*.c:
  198. !ifndef PRECH
  199.         $(CC) -I$(INCLUDE) $(HELPERS)\$*.c
  200. !else
  201.         $(CC) /fi"$(PRECH)\$*.pch" /si"$(PRECH)\$*.pch" -I$(INCLUDE) $(HELPERS)\$*.c
  202. !endif
  203.  
  204. # 3) create/update .H, .IH, .C files when .IDL has changed
  205. .idl.h:
  206.         sc -p -v -r -maddstar -mnoint -S128000 -C128000  $*.idl
  207.         sc -p -v -r -maddstar -mnoint -S128000 -C128000 -sc $*.idl
  208.         sc -p -v -r -maddstar -mnoint -S128000 -C128000 -s def $*.idl
  209.         strrpl $*.ih "#pragma checkout(suspend)" " "
  210.         strrpl $*.ih "#pragma checkout(resume)" " "
  211.  
  212. .idl.ih:
  213.         sc -p -v -r -maddstar -mnoint -S128000 -C128000  $*.idl
  214.         sc -p -v -r -maddstar -mnoint -S128000 -C128000 -sc $*.idl
  215.         sc -p -v -r -maddstar -mnoint -S128000 -C128000 -s def $*.idl
  216.         strrpl $*.ih "#pragma checkout(suspend)" " "
  217.         strrpl $*.ih "#pragma checkout(resume)" " "
  218.  
  219. # The main target files are sound.dll and xfldr.dll in the XFolder
  220. # installation directory (see the rules at the very bottom). These
  221. # are dependent of the DLLs in /MAIN, so that everything always
  222. # gets updated properly.
  223. all: $(XFRUNNING)\bin\sound.dll $(XFRUNNING)\bin\xfldr.dll
  224. # all: doc.exe
  225.  
  226. #
  227. # Now define rules for invoking the SOM compiler (sc.exe),
  228. # using the .idl.h rule defined above. E.g., xfobj.h/.ih/.c will be
  229. # updated by the SOM compiler when xfobj.idl has changed.
  230. #
  231.  
  232. # XFldObject class
  233. xfobj.h:   xfobj.idl
  234. xfobj.ih:  xfobj.idl
  235.  
  236. # XFolder classes
  237. xfldr.h:   xfldr.idl
  238. xfldr.ih:  xfldr.idl
  239.  
  240. # XFldDisk class
  241. xfdisk.h:   xfdisk.idl
  242.  
  243. # XFldDesktop class
  244. xfdesk.h:   xfdesk.idl
  245.  
  246. # XFldSystem/XFldWPS classes
  247. xfsys.h:   xfsys.idl
  248.  
  249. # XFldDataFile class
  250. xfdataf.h:   xfdataf.idl
  251.  
  252. # XFldProgramFile class (new with V0.84)
  253. xfpgmf.h:   xfpgmf.idl
  254.  
  255. #
  256. # Now define inference rules for all our .OBJ files by telling NMAKE
  257. # which .OBJ file depends on what. For each .OBJ we define what files
  258. # will enforce a recompilation when they've been changed.
  259. #
  260.  
  261. # The INFALL macro is used with inference rules to determine which
  262. # include file will cause all files to be rebuilt.
  263. INFALL = $(HELPERS)\dosh.h
  264.  
  265. # The INCOMMON macro is used with inference rules for files which
  266. # include common.h. Since common.h includes other headers, we're
  267. # dependent of them too.
  268. INFCOMMON = common.h $(HELPERS)\pmprintf.h
  269.  
  270. # Special macros used here: $* is the current target w/out ext.
  271.  
  272. # Helper .OBJ files from /HELPERS. The object files are created in the
  273. # /MAIN directory too.
  274.  
  275. animate.obj:   $(HELPERS)\$*.c $(HELPERS)\$*.h \
  276.                $(HELPERS)\winh.h $(HELPERS)\gpih.h \
  277.                $(INFALL)
  278.  
  279. dosh.obj:      $(HELPERS)\$*.c $(HELPERS)\$*.h \
  280.                $(INFALL)
  281.  
  282. eas.obj:       $(HELPERS)\$*.c $(HELPERS)\$*.h \
  283.                $(INFALL)
  284.  
  285. gpih.obj:      $(HELPERS)\$*.c $(HELPERS)\$*.h \
  286.                $(HELPERS)\winh.h \
  287.                $(INFALL)
  288.  
  289. linklist.obj:  $(HELPERS)\$*.c $(HELPERS)\$*.h \
  290.                $(INFALL)
  291.  
  292. progbars.obj:  $(HELPERS)\$*.c $(HELPERS)\$*.h \
  293.                $(HELPERS)\gpih.h \
  294.                $(INFALL)
  295.  
  296. procstat.obj:  $(HELPERS)\$*.c $(HELPERS)\$*.h \
  297.                $(INFALL)
  298.  
  299. shapewin.obj:  $(HELPERS)\$*.c $(HELPERS)\$*.h \
  300.                $(HELPERS)\gpih.h \
  301.                $(INFALL)
  302.  
  303. stringh.obj:   $(HELPERS)\$*.c $(HELPERS)\$*.h \
  304.                $(INFALL)
  305.  
  306. threads.obj:   $(HELPERS)\$*.c $(HELPERS)\$*.h \
  307.                $(INFALL)
  308.  
  309. winh.obj:      $(HELPERS)\$*.c $(HELPERS)\$*.h \
  310.                $(HELPERS)\gpih.h $(HELPERS)\winh.h \
  311.                $(INFALL)
  312.  
  313. prfh.obj:      $(HELPERS)\$*.c $(HELPERS)\$*.h \
  314.                $(INFALL)
  315.  
  316. wphandle.obj:  $(HELPERS)\$*.c $(HELPERS)\$*.h \
  317.                $(INFALL)
  318.  
  319. # XFolder "library" .OBJ files used by several classes.
  320.  
  321. apm.obj        :      $*.c $*.h \
  322.                       $(INFALL)
  323.  
  324. classlst.obj        : $*.c $*.h \
  325.                       $(HELPERS)\winh.h $(HELPERS)\linklist.h \
  326.                       dlgids.h cnrsort.h \
  327.                       $(INFALL) $(INFCOMMON)
  328.  
  329. common.obj        :   $*.c $*.h \
  330.                       $(HELPERS)\winh.h $(HELPERS)\linklist.h $(HELPERS)\undoc.h \
  331.                       dlgids.h module.h sound.h except.h statbars.h xshutdwn.h xwps.h \
  332.                       xfldr.h \
  333.                       $(INFALL) $(INFCOMMON)
  334.  
  335. cnrsort.obj        :  $*.c $*.h \
  336.                       $(INFALL)
  337.  
  338. debug.obj:            $*.c $*.h \
  339.                       $(INFALL)
  340.  
  341. except.obj:           $*.c $*.h \
  342.                       dlgids.h xthreads.h debug.h \
  343.                       xfldr.h \
  344.                       $(INFALL)
  345.  
  346. menus.obj        :    $*.c $*.h \
  347.                       $(HELPERS)\winh.h $(HELPERS)\linklist.h $(HELPERS)\stringh.h $(HELPERS)\undoc.h \
  348.                       dlgids.h except.h module.h sound.h xshutdwn.h xthreads.h xwps.h \
  349.                       xfldr.ih xfdisk.h \
  350.                       $(INFALL) $(INFCOMMON)
  351.  
  352. module.obj        :   $*.c $*.h \
  353.                       $(INFALL)
  354.  
  355. notebook.obj      :   $*.c $*.h \
  356.                       $(HELPERS)\winh.h $(HELPERS)\linklist.h \
  357.                       dlgids.h except.h \
  358.                       xfdesk.h \
  359.                       $(INFALL) $(INFCOMMON)
  360.  
  361. statbars.obj        : $*.c $*.h \
  362.                       $(HELPERS)\winh.h $(HELPERS)\stringh.h \
  363.                       dlgids.h except.h xwps.h \
  364.                       xfldr.h xfobj.h xfdisk.h \
  365.                       $(INFALL) $(INFCOMMON)
  366.  
  367. xshutdwn.obj:         $*.c $*.h \
  368.                       $(HELPERS)\winh.h $(HELPERS)\prfh.h $(HELPERS)\animate.h $(HELPERS)\linklist.h $(HELPERS)\procstat.h $(HELPERS)\progbars.h \
  369.                       dlgids.h apm.h except.h menus.h module.h notebook.h sound.h xthreads.h xwps.h \
  370.                       xfldr.h \
  371.                       $(INFALL)
  372.  
  373. xthreads.obj:         $*.c $*.h \
  374.                       $(HELPERS)\winh.h $(HELPERS)\prfh.h $(HELPERS)\animate.h $(HELPERS)\eas.h $(HELPERS)\linklist.h $(HELPERS)\shapewin.h \
  375.                       xfldr.h xfdesk.h \
  376.                       dlgids.h apm.h except.h module.h sound.h xthreads.h xwps.h \
  377.                       $(INFALL) $(INFCOMMON)
  378.  
  379. xwps.obj:             $*.c $*.h \
  380.                       $(HELPERS)\winh.h \
  381.                       except.h \
  382.                       $(INFALL) $(INFCOMMON)
  383.  
  384. # Now follow the .OBJs for the SOM/WPS classes. Each class needs to be
  385. # recompiled when its SOM header files change (due to SOM recompilation)
  386. # or when the "library" header files have changed.
  387.  
  388. xfdataf.obj        :  $*.c $*.ih $*.h \
  389.                       $(HELPERS)\winh.h \
  390.                       dlgids.h menus.h \
  391.                       $(INFALL) $(INFCOMMON)
  392.  
  393. xfdesk.obj        :   $*.c $*.ih $*.h \
  394.                       $(HELPERS)\winh.h $(HELPERS)\animate.h \
  395.                       dlgids.h apm.h notebook.h sound.h xshutdwn.h xthreads.h \
  396.                       $(INFALL) $(INFCOMMON)
  397.  
  398. xfdisk.obj        :   $*.c $*.ih $*.h \
  399.                       $(HELPERS)\undoc.h \
  400.                       xfldr.h \
  401.                       menus.h statbars.h xwps.h \
  402.                       $(INFALL) $(INFCOMMON)
  403.  
  404. xfldr.obj        :    $*.c $*.ih $*.h \
  405.                       $(HELPERS)\winh.h $(HELPERS)\gpih.h $(HELPERS)\eas.h $(HELPERS)\linklist.h $(HELPERS)\wphandle.h \
  406.                       dlgids.h cnrsort.h except.h menus.h module.h notebook.h sound.h statbars.h xthreads.h xwps.h \
  407.                       xfobj.h xfdesk.h xfdisk.h \
  408.                       $(INFALL) $(INFCOMMON)
  409.  
  410. xfobj.obj        :    $*.c $*.ih $*.h \
  411.                       $(HELPERS)\winh.h $(HELPERS)\linklist.h $(HELPERS)\procstat.h $(HELPERS)\progbars.h $(HELPERS)\stringh.h $(HELPERS)\undoc.h $(HELPERS)\wphandle.h \
  412.                       dlgids.h classlst.h cnrsort.h xshutdwn.h xthreads.h \
  413.                       xfldr.h \
  414.                       $(INFALL) $(INFCOMMON)
  415.  
  416. xfpgmf.obj        :   $*.c $*.ih $*.h \
  417.                       $(INFALL) $(INFCOMMON)
  418.  
  419. xfsys.obj        :    $*.c $*.ih $*.h \
  420.                       $(HELPERS)\winh.h $(HELPERS)\animate.h $(HELPERS)\linklist.h $(HELPERS)\procstat.h $(HELPERS)\stringh.h $(HELPERS)\undoc.h \
  421.                       dlgids.h classlst.h cnrsort.h module.h notebook.h statbars.h xthreads.h \
  422.                       xfldr.h xfdesk.h xfobj.h \
  423.                       $(INFALL) $(INFCOMMON)
  424.  
  425. # XFolder language-in dependent resource file
  426. xfldr.res: xfldr.rc dlgids.h *.ico
  427.          $(RC) -r xfldr.rc $*.res
  428.  
  429. #
  430. # Finally, define rules for linking XFLDR.DLL.
  431. # This uses the $OBJS and $HLPOBJS macros defined at the top.
  432. # Note that the linker is invoked if any of the OBJS files
  433. # or any file in the /HELPERS directory have changed.
  434. #
  435.  
  436. # If the file in the installation directory is older than the one
  437. # in the source directory, update it.
  438. # This also sets the dependency on xfldr.dll at the bottom.
  439. $(XFRUNNING)\bin\xfldr.dll: xfldr.dll
  440.         unlock $(XFRUNNING)\bin\xfldr.dll
  441.         cmd.exe /c copy xfldr.dll $(XFRUNNING)\bin
  442.         cmd.exe /c copy xfldr.sym $(XFRUNNING)\bin
  443.  
  444. xfldr.dll: xfjoint.def $(OBJS) $(HLPOBJS) xfldr.res xfldr.mak
  445.         $(LINK) /OUT:xfldr.dll xfjoint.def $(LIBS) $(OBJS) $(HLPOBJS)
  446.         $(RC) xfldr.res xfldr.dll
  447.         mapsym /n $*.map
  448.  
  449. # Here comes SOUND.DLL which is new with V0.82.
  450. # For compiling, we use an additional compiler option because
  451. # we're using the subsystem libraries (/rn).
  452.  
  453. sound.obj         :  $*.c $*.h $(INFALL)
  454. !ifndef PRECH
  455.     $(CC) /rn -I$(INCLUDE) $*.c
  456. !else
  457.     $(CC) /rn /fi"$(PRECH)\$*.pch" /si"$(PRECH)\$*.pch" -I$(INCLUDE) $*.c
  458. !endif
  459.  
  460. $(XFRUNNING)\bin\sound.dll: sound.dll
  461.         unlock $(XFRUNNING)\bin\sound.dll
  462.         cmd.exe /c copy sound.dll $(XFRUNNING)\bin
  463.         cmd.exe /c copy sound.sym $(XFRUNNING)\bin
  464.  
  465. sound.dll: sound.def sound.obj xfldr.mak
  466.          $(LINK) /OUT:sound.dll sound.obj sound.def mmpm2.lib $(HELPERS)\pmprintf.lib
  467.         mapsym /n $*.map
  468.  
  469.  
  470.  
  471.  
  472. doc.exe: doc.cpp
  473.         icc /c /tdp doc.cpp
  474.         ilink doc.obj /pmtype:vio
  475.  
  476.