home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_300 / 368_01 / gnulibas.zoo / makefile < prev    next >
Makefile  |  1990-09-19  |  5KB  |  180 lines

  1. # makefile. - make the GNUish MS-DOS library
  2. # Copyright (C) 1990 by Thorsten Ohl, td12@ddagsi3.bitnet
  3. #
  4. # The GNUish MS-DOS library is free software; you can redistribute it
  5. # and/or modify it under the terms of the GNU General Public License as
  6. # published by the Free Software Foundation; either version 1, or (at your
  7. # option) any later version.
  8. #
  9. # The GNUish MS-DOS library is distributed in the hope that it will be
  10. # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. # General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License along
  15. # with the GNUish MS-DOS library; see the file COPYING.  If not, write to
  16. # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  17. #
  18. # $Header: e:/gnu/lib/RCS/makefile 1.0.0.3 90/09/19 23:21:14 tho Exp $
  19. #
  20.  
  21. # The name of the library and the memory model we want to create:
  22. # Hint: use `make MODEL="s l"' to make only some memory models
  23.  
  24. LIBNAME    = gnulib_
  25. MODELS    = s m c l
  26.  
  27. # Where to put the library and header files.
  28.  
  29. INSTALL    = cp -v
  30. LIBDIR    = d:/usr/lib
  31. INCDIR    = d:/usr/include
  32.  
  33. # The floppy drive and the zip archive for backups
  34.  
  35. DISK    = b:
  36. ZIPFILE = gnulib.zip
  37.  
  38. LIBS    = $(addprefix $(LIBNAME), $(addsuffix .lib, $(MODELS))) _cwild.c
  39.  
  40. DEFINES    = -DUSG -DSTDC_HEADERS
  41.  
  42. CFLAGS    = -Ox -W4 -Za -I. $(DEFINES)
  43. ARFLAGS = /noi -+
  44.  
  45. # Files
  46.  
  47. OBJS    = error.obj getopt.obj getopt1.obj glob.obj regex.obj \
  48.       xmalloc.obj xrealloc.obj ndir.obj pwd.obj
  49. INCS    = getopt.h regex.h \
  50.       gnulib.h ndir.h pwd.h
  51. SRCS    = error.c getopt.c getopt1.c glob.c regex.c \
  52.       xmalloc.c xrealloc.c _cwild.c ndir.c pwd.c
  53. GNUFILES= getopt.h getopt.c getopt1.c error.c glob.c regex.h regex.c
  54.  
  55. GNUVER    = 1.1
  56.  
  57. RCSFILES = $(addprefix RCS/, $(SRCS) $(INCS) makefile)
  58. MISC     = readme copying changelo
  59.  
  60.  
  61. # Main goal
  62.  
  63. .PHONY: all
  64. all: $(LIBS)
  65.  
  66.  
  67. # How to make the libraries:
  68.  
  69. %.lib:
  70.     $(AR) $@ $(ARFLAGS) $(subst /,\\,$?), $(@:.lib=.lst),,
  71.  
  72. $(LIBNAME)s.lib: $(addprefix small/, $(OBJS))
  73. $(LIBNAME)m.lib: $(addprefix medium/, $(OBJS))
  74. $(LIBNAME)c.lib: $(addprefix compact/, $(OBJS))
  75. $(LIBNAME)l.lib: $(addprefix large/, $(OBJS))
  76.  
  77.  
  78. # Generate the object files for the different memory models in their
  79. # subdirectories ...
  80.  
  81. small/%.obj: %.c small
  82.     $(CC) -AS $(CFLAGS) $(CPPFLAGS) -c -Fo$@ $<
  83.  
  84. medium/%.obj: %.c medium
  85.     $(CC) -AM $(CFLAGS) $(CPPFLAGS) -c -Fo$@ $<
  86.  
  87. compact/%.obj: %.c compact
  88.     $(CC) -AC $(CFLAGS) $(CPPFLAGS) -c -Fo$@ $<
  89.  
  90. large/%.obj: %.c large
  91.     $(CC) -AL $(CFLAGS) $(CPPFLAGS) -c -Fo$@ $<
  92.  
  93. small medium compact large:
  94.     mkdir $@
  95.  
  96.  
  97. # Dependencies:
  98.  
  99. $(addsuffix /regex.obj,        small medium compact large): regex.h
  100. $(addsuffix /getopt1.obj,    small medium compact large): getopt.h
  101. $(addsuffix /glob.obj,        small medium compact large): ndir.h gnulib.h
  102. $(addsuffix /error.obj,        small medium compact large): gnulib.h
  103. $(addsuffix /ndir.obj,        small medium compact large): ndir.h
  104. $(addsuffix /pwd.obj,        small medium compact large): pwd.h
  105. $(addsuffix /xmalloc.obj,    small medium compact large): gnulib.h
  106. $(addsuffix /xrealloc.obj,    small medium compact large): gnulib.h
  107.  
  108.  
  109. # Utilities:
  110.  
  111. tags: $(SOURCES) $(SPLIT_FILES)
  112.     etags *.c $(SPLIT_FILES)
  113.  
  114. .PHONY: install
  115. install: all _cwild.c
  116.     $(INSTALL) $(LIBS) $(LIBDIR)
  117.     $(INSTALL) $(INCS) $(INCDIR)
  118.  
  119. .PHONY: clean veryclean
  120. clean:
  121.     rm -fr small medium compact large DOS GNU
  122.     rm -f *.bak *.tar *.z
  123.  
  124. veryclean: clean
  125.     rm -f *.uue *.lib *.lst patches
  126.     rcsclean *.c *.h makefile
  127.  
  128. .PHONY: zip disk
  129. zip: $(ZIPFILE)
  130. disk: $(DISK)/$(ZIPFILE)
  131.  
  132. $(ZIPFILE): $(RCSFILES) $(MISC)
  133.     pkzip -P -r- $@ $?
  134.  
  135. $(DISK)/$(ZIPFILE): $(ZIPFILE)
  136.     cp $< $@
  137.     pkunzip -t $@ | grep -vw OK
  138.  
  139.  
  140. .PHONY: dist
  141. dist: gnulib-1.uue gnulib-2.uue
  142.  
  143. %.uue: %.tar
  144.     compress < $< | uuencode $<.Z > $@
  145.  
  146. %.tar:
  147.     tar -cf $@ $^
  148.  
  149. gnulib-1.tar: readme copying makefile \
  150.           $(filter-out regex.%, $(INCS) $(SRCS)) patches
  151. gnulib-2.tar: readme copying $(filter regex.%, $(INCS) $(SRCS))
  152.  
  153. patches: $(addprefix DOS/, $(GNUFILES)) $(addprefix GNU/, $(GNUFILES))
  154.     diff -c DOS GNU > $@
  155.  
  156. GNU/%: % gnu
  157.     $(CO) -rGNU RCS/$< $@
  158.  
  159. DOS/%: % dos
  160.     $(CO) RCS/$< $@
  161.  
  162. gnu dos:
  163.     mkdir $@
  164.  
  165. .PHONY: test-dist
  166. test-dist: gnulib-1.uue $(addprefix GNU/, $(GNUFILES)) \
  167.         $(addprefix DOS/, $(GNUFILES))
  168.     sed /\.tar\.Z/s//.Z/ gnulib-1.uue | uudecode
  169.     compress -d < $ gnulib-1.Z | tar -xOf -  patches | patch -s -d DOS
  170.     rm -f DOS/*~
  171.     diff DOS GNU
  172.  
  173. #
  174. # Local Variables:
  175. # mode:Text
  176. # ChangeLog:ChangeLog
  177. # compile-command:make
  178. # End:
  179.  
  180.