home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / quot210s.zip / Makefile < prev    next >
Makefile  |  1998-12-15  |  10KB  |  304 lines

  1. #
  2. # Makefile for the OS/2 Quoteriser
  3. #
  4. #      Created: 18th January, 1997
  5. # Version 1.00: 11th April, 1997
  6. # Version 2.00: 21st December, 1997
  7. # Version 2.01: 28th December, 1997
  8. # Version 2.10: 1st December, 1998
  9. #
  10. # (C) 1997-1998 Nicholas Paul Sheppard
  11. #
  12. # This file is distributed under the GNU General Public License. See the
  13. # file COPYING for details.
  14. #
  15.  
  16.  
  17. #
  18. # Directories. Mine are for compiling files from sub-directories of the
  19. # current directory into binaries in different sub-directories of the
  20. # current directory.
  21. #
  22. # SRC   - directory for source files
  23. # INCL  - directory for header files
  24. # BIN   - directory for normal executables
  25. # DEBUG - directory for debug-enabled executables
  26. # DOC   - directory for documentation
  27. # DIST  - directory into which to place distribution files
  28. # ETC   - directory for misellaneous files (icons)
  29. #
  30.  
  31. SRC   = src
  32. INCL  = include
  33. BIN   = bin
  34. DEBUG = debug
  35. DOC   = doc
  36. DIST  = .
  37. ETC   = etc
  38.  
  39. #
  40. # Compiler and linker names, options, directories, etc., common to the normal and
  41. # debug compilations.
  42. #
  43. # CC       - name of the compiler
  44. # LINK     - name of the linker
  45. # LIBS     - path to pre-compiled libraries
  46. # RC       - resource compiler
  47. # RFLAGS   - options to pass to the resource compiler
  48. # IMPLIB   - name of the import library creator
  49. # IFLAGS   - options to pass to the import library creator
  50. #
  51.  
  52. CC       = gcc
  53. LINK     = gcc
  54. LIBS     = /emx/lib
  55. RC       = rc
  56. RFLAGS   = -x2 -I /emx/include -I $(INCL)
  57. IMPLIB   = emximp
  58. IFLAGS   =
  59.  
  60. #
  61. # Other programs
  62. #
  63. # RM   - command to use for deletion of files
  64. # ZIP  - command to use for archiving files
  65. #
  66. RM  = rm -f
  67. ZIP = zip -9 -u
  68.  
  69. #
  70. # Targets. We use a nasty recursive make here to compile the normal
  71. # and debug versions. The options are:
  72. #
  73. # CFLAGS  - options to pass to the compiler
  74. # LXFLAGS - options to pass to the linker for .EXEs
  75. # LLFLAGS - options to pass to the linker for .DLLs
  76. # LCFLAGS - options to pass to the linker for the DLL containing the C library functions
  77. # CDEF    - definition file for the DLL containing the C library functions
  78. # O       - extension for object files (including the .)
  79. # L       - extension for library files (including the .)
  80. # OUT     - the output directory
  81. #
  82. #
  83. # Note that there is a 'package' target at the end of the makefile, as are
  84. # the clean-* targets that actually do the work
  85. #
  86.  
  87. .PHONY: \
  88. bin debug exes clean spotless package \
  89. clean-bin clean-debug clean-objs spotless-bin spotless-debug spotless-exes
  90.  
  91. all: bin debug
  92.  
  93. bin:
  94.     $(MAKE) exes \
  95.                 "CFLAGS=-I $(INCL) -Zomf -Zmt -m486 -O2 -Wall" \
  96.                 "LXFLAGS=-Zomf -Zcrtdll=quoter1 -Zmt -s" \
  97.                 "LLFLAGS=-Zomf -Zcrtdll=quoter1 -Zdll -Zmt" \
  98.                 "LCFLAGS=-Zomf -Zsys -Zdll -Zmt" "CDEF=$(SRC)/quoter1.def" \
  99.                 "O=.obj" "L=.lib" "OUT=$(BIN)"
  100.  
  101. debug:
  102.     $(MAKE) exes \
  103.                 "CFLAGS=-I $(INCL) -Zmt -g" \
  104.                 "LXFLAGS=-Zmt -g" \
  105.                 "LLFLAGS=-Zmt -Zdll -g" \
  106.                 "LCFLAGS=-Zmt -Zdll -g" "CDEF=$(SRC)/quoter1d.def" \
  107.                 "O=.o" "L=.a" "OUT=$(DEBUG)"
  108.  
  109. exes: \
  110. $(OUT)/quoter.exe $(OUT)/qotd.exe $(OUT)/sig.exe $(OUT)/quoterc.exe \
  111. $(OUT)/quoterdb.dll $(OUT)/quoterla.dll $(OUT)/quoter1.dll
  112.  
  113. clean: clean-bin clean-debug
  114.  
  115. clean-bin:
  116.     $(MAKE) clean-objs "O=.obj" "L=.lib" "OUT=$(BIN)"
  117.  
  118. clean-debug:
  119.     $(MAKE) clean-objs "O=.o" "L=.a" "OUT=$(DEBUG)"
  120.  
  121. spotless: spotless-bin spotless-debug
  122.  
  123. spotless-bin: clean-bin
  124.     $(MAKE) spotless-exes "OUT=$(BIN)"
  125.  
  126. spotless-debug: clean-debug
  127.     $(MAKE) spotless-exes "OUT=$(DEBUG)"
  128.  
  129. #
  130. # Rules for linking.
  131. #
  132.  
  133. $(OUT)/%.exe:
  134.     $(LINK) $(LXFLAGS) -o $@ $^
  135.  
  136. $(OUT)/%.dll:
  137.     $(LINK) $(LLFLAGS) -o $@ $^
  138.  
  139. #
  140. # Rules for creating import libraries
  141. #
  142.  
  143. $(OUT)/%$(L):
  144.     $(IMPLIB) $(IFLAGS) -o $@ $^
  145.  
  146. #
  147. # Rules for resource files
  148. #
  149.  
  150. $(OUT)/%.res: $(SRC)/%.rc
  151.     $(RC) $(RFLAGS) -r $< $@
  152.  
  153. #
  154. # Rules for object files
  155. #
  156.  
  157. $(OUT)/%$(O): $(SRC)/%.c
  158.     $(CC) $(CFLAGS) -o $@ -c $<
  159.  
  160. #
  161. # quoter1.dll contains the C library functions, so it has a different rule from the
  162. # normal .DLL rule.
  163. #
  164. $(OUT)/quoter1.dll: $(CDEF) \
  165. $(OUT)/str$(O) $(OUT)/dir$(O) $(OUT)/pmscroll$(O) $(OUT)/pmspawn$(O)
  166.     $(LINK) $(LCFLAGS) -o $@ $^ -lxtype
  167.  
  168. #
  169. # Executable dependencies
  170. #
  171.  
  172. $(OUT)/quoter.exe: \
  173. $(OUT)/quoter$(O) $(OUT)/quoter_p$(O) $(OUT)/settings$(O) $(OUT)/adlg$(O) $(OUT)/qdlg$(O) \
  174. $(OUT)/quoterdb$(L) $(OUT)/quoterla$(L) $(OUT)/quoter1$(L) \
  175. $(OUT)/quoter.res $(SRC)/quoter.def
  176.  
  177. $(OUT)/qotd.exe: \
  178. $(OUT)/qotd$(O) $(OUT)/qotd_p$(O) \
  179. $(OUT)/quoterdb$(L) $(OUT)/quoterla$(L) $(OUT)/quoter1$(L) \
  180. $(OUT)/qotd.res $(SRC)/qotd.def
  181.  
  182. $(OUT)/sig.exe: \
  183. $(OUT)/sig$(O) \
  184. $(OUT)/quoterdb$(L) $(OUT)/quoterla$(L) $(OUT)/quoter1$(L) $(SRC)/sig.def
  185.  
  186. $(OUT)/quoterc.exe: \
  187. $(OUT)/quoterc$(O) \
  188. $(OUT)/quoterdb$(L) $(OUT)/quoterla$(L) $(OUT)/quoter1$(L) $(SRC)/quoterc.def
  189.  
  190. $(OUT)/quoterdb.dll: \
  191. $(OUT)/qdb$(O) $(OUT)/quotes$(O) $(OUT)/qsearch$(O) $(OUT)/qthreads$(O) \
  192. $(OUT)/adb$(O) $(OUT)/authors$(O) $(OUT)/asearch$(O) $(OUT)/athreads$(O) \
  193. $(SRC)/quoterdb.def $(OUT)/quoter1$(L) $(OUT)/quoterla$(L) $(LIBS)/gdbm$(L) \
  194. $(LIBS)/rx$(L)
  195.  
  196. $(OUT)/quoterla.dll: \
  197. $(OUT)/html$(O) $(OUT)/htmlattr$(O) $(OUT)/qccmd$(O) $(OUT)/qcdata$(O) \
  198. $(OUT)/typeset$(O) \
  199. $(SRC)/quoterla.def $(OUT)/quoter1$(L) $(OUT)/quoterdb$(L)
  200.  
  201.  
  202. #
  203. # Import library dependencies
  204. #
  205.  
  206. $(OUT)/quoterdb$(L): $(SRC)/quoterdb.def
  207. $(OUT)/quoterla$(L): $(SRC)/quoterla.def
  208. $(OUT)/quoter1$(L): $(CDEF)
  209.  
  210. #
  211. # Object file dependencies
  212. #
  213.  
  214. $(OUT)/adb$(O): $(SRC)/adb.c $(INCL)/authors.h
  215. $(OUT)/adlg$(O): $(SRC)/adlg.c $(INCL)/quoter.h $(INCL)/types.h $(INCL)/authors.h $(INCL)/threads.h $(INCL)/general.h $(INCL)/pmutil.h
  216. $(OUT)/asearch$(O): $(SRC)/asearch.c $(INCL)/authors.h
  217. $(OUT)/athreads$(O): $(SRC)/athreads.c $(INCL)/authors.h $(INCL)/threads.h $(INCL)/types.h
  218. $(OUT)/authors$(O): $(SRC)/authors.c $(INCL)/authors.h
  219. $(OUT)/dir$(O): $(SRC)/dir.c $(INCL)/general.h
  220. $(OUT)/html$(O): $(SRC)/html.c $(INCL)/html.h $(INCL)/general.h
  221. $(OUT)/htmlattr$(O): $(SRC)/htmlattr.c $(INCL)/html.h $(INCL)/general.h
  222. $(OUT)/pmscroll$(O): $(SRC)/pmscroll.c $(INCL)/pmutil.h
  223. $(OUT)/pmspawn$(O): $(SRC)/pmspawn.c $(INCL)/pmutil.h
  224. $(OUT)/qccmd$(O): $(SRC)/qccmd.c $(INCL)/authors.h $(INCL)/general.h $(INCL)/quoterc.h $(INCL)/quotes.h
  225. $(OUT)/qcdata$(O): $(SRC)/qcdata.c $(INCL)/authors.h $(INCL)/quoterc.h $(INCL)/quotes.h
  226. $(OUT)/qdb$(O): $(SRC)/qdb.c $(INCL)/quotes.h
  227. $(OUT)/qdlg$(O): $(SRC)/qdlg.c $(INCL)/quoter.h $(INCL)/types.h $(INCL)/quotes.h $(INCL)/threads.h $(INCL)/general.h $(INCL)/pmutil.h
  228. $(OUT)/qotd$(O): $(SRC)/qotd.c $(INCL)/qotd.h $(INCL)/general.h $(INCL)/authors.h $(INCL)/quotes.h $(INCL)/types.h $(INCL)/threads.h $(INCL)/pmutil.h
  229. $(OUT)/qotd.res: $(SRC)/qotd.rc $(INCL)/qotd.h $(ETC)/quoter.ico
  230. $(OUT)/qotd_p$(O): $(SRC)/qotd_p.c $(INCL)/qotd.h $(INCL)/types.h $(INCL)/threads.h $(INCL)/typeset.h $(INCL)/pmutil.h
  231. $(OUT)/qsearch$(O): $(SRC)/qsearch.c $(INCL)/quotes.h
  232. $(OUT)/qthreads$(O): $(SRC)/qthreads.c $(INCL)/quotes.h $(INCL)/threads.h $(INCL)/types.h
  233. $(OUT)/quotes$(O): $(SRC)/quotes.c $(INCL)/quotes.h
  234. $(OUT)/quoter$(O): $(SRC)/quoter.c $(INCL)/quoter.h $(INCL)/general.h $(INCL)/authors.h $(INCL)/quotes.h $(INCL)/types.h $(INCL)/threads.h $(INCL)/pmutil.h
  235. $(BIN)/quoterc$(O): $(SRC)/quoterc.c $(INCL)/quoterc.h
  236. $(OUT)/quoter.res: $(SRC)/quoter.rc $(SRC)/settings.rc $(SRC)/adlg.rc $(SRC)/qdlg.rc $(INCL)/quoter.h $(ETC)/quoter.ico
  237. $(OUT)/quoter_p$(O): $(SRC)/quoter_p.c $(INCL)/quoter.h $(INCL)/types.h $(INCL)/threads.h $(INCL)/typeset.h $(INCL)/pmutil.h
  238. $(OUT)/settings$(O): $(SRC)/settings.c $(INCL)/quoter.h $(INCL)/threads.h $(INCL)/types.h
  239. $(OUT)/sig$(O): $(SRC)/sig.c $(INCL)/quotes.h $(INCL)/authors.h $(INCL)/html.h $(INCL)/general.h $(INCL)/typeset.h
  240. $(OUT)/str$(O): $(SRC)/str.c $(INCL)/general.h
  241. $(OUT)/typeset$(O): $(SRC)/typeset.c $(INCL)/typeset.h $(INCL)/html.h
  242.  
  243. #
  244. # Include file dependencies
  245. #
  246. #(INCL)/quoterc.h: $(INCL)/authors.h $(INCL)/quotes.h
  247. $(INCL)/quotes.h: $(INCL)/authors.h
  248. $(INCL)/threads.h: $(INCL)/types.h
  249. $(INCL)/types.h: $(INCL)/quotes.h $(INCL)/authors.h
  250.  
  251. #
  252. # Rules for cleaning up the mess we've made
  253. #
  254.  
  255. clean-objs:
  256.     if exist $(OUT)/*$(O) $(RM) $(OUT)/*$(O)
  257.     if exist $(OUT)/*$(L) $(RM) $(OUT)/*$(L)
  258.     if exist $(OUT)/*.res $(RM) $(OUT)/*.res
  259.  
  260. spotless-exes:
  261.     if exist $(OUT)/*.exe $(RM) $(OUT)/*.exe
  262.     if exist $(OUT)/*.dll $(RM) $(OUT)/*.dll
  263.  
  264. #
  265. # Rules for producing the distribution packages.
  266. #
  267. package: $(DIST)/quot210x.zip $(DIST)/quot210s.zip
  268.  
  269. $(DIST)/%.zip:
  270.     $(ZIP) $@ $^
  271.  
  272. #
  273. # This is the list of files that go into the quot210x.zip (binary) distribution
  274. # file.
  275. #
  276. $(DIST)/quot210x.zip: \
  277. install.cmd readme.txt $(DOC)/copying.txt $(ETC)/quoter.ico \
  278. $(BIN)/qotd.exe $(BIN)/quoter.exe $(BIN)/sig.exe $(BIN)/quoterc.exe \
  279. $(BIN)/quoterdb.dll $(BIN)/quoterla.dll $(BIN)/quoter1.dll \
  280. $(DOC)/history.txt $(DOC)/intro.htm $(DOC)/quoter.htm $(DOC)/quoterc.htm \
  281. $(DOC)/qotd.htm $(DOC)/sig.htm
  282.  
  283. #
  284. # This is the list of files that go into the quot210s.zip (source) distribution
  285. # file.
  286. #
  287. $(DIST)/quot210s.zip: \
  288. bin debug build.cmd install.cmd readme.txt $(DOC)/copying.txt $(ETC)/quoter.ico \
  289. Makefile Makefile.unx $(ETC)/gdbm.pat $(ETC)/gnurx.pat \
  290. $(INCL)/authors.h $(INCL)/general.h $(INCL)/html.h $(INCL)/pmutil.h \
  291. $(INCL)/qotd.h $(INCL)/quoter.h $(INCL)/quoterc.h $(INCL)/quotes.h \
  292. $(INCL)/threads.h $(INCL)/types.h $(INCL)/typeset.h \
  293. $(SRC)/adb.c $(SRC)/adlg.c $(SRC)/asearch.c $(SRC)/athreads.c $(SRC)/authors.c \
  294. $(SRC)/dir.c $(SRC)/html.c $(SRC)/htmlattr.c $(SRC)/pmscroll.c $(SRC)/pmspawn.c \
  295. $(SRC)/qccmd.c $(SRC)/qcdata.c $(SRC)/qdb.c $(SRC)/qdlg.c $(SRC)/qotd.c \
  296. $(SRC)/qotd_p.c $(SRC)/qsearch.c $(SRC)/qthreads.c $(SRC)/quoter.c $(SRC)/quoterc.c \
  297. $(SRC)/quoter_p.c $(SRC)/quotes.c $(SRC)/settings.c $(SRC)/sig.c $(SRC)/str.c \
  298. $(SRC)/typeset.c $(SRC)/adlg.rc $(SRC)/qdlg.rc $(SRC)/qotd.rc $(SRC)/quoter.rc \
  299. $(SRC)/settings.rc $(SRC)/qotd.def $(SRC)/quoter.def $(SRC)/sig.def \
  300. $(SRC)/quoter.def $(SRC)/quoter1.def $(SRC)/quoterc.def $(SRC)/quoterdb.def \
  301. $(SRC)/quoter1d.def $(SRC)/quoterla.def \
  302. $(DOC)/history.txt $(DOC)/intro.htm $(DOC)/quoter.htm $(DOC)/quoterc.htm \
  303. $(DOC)/qotd.htm $(DOC)/sig.htm $(DOC)/source.htm
  304.