home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 11 Util / 11-Util.zip / file39a.zip / src / Makefile.os2 < prev    next >
Makefile  |  1993-07-31  |  4KB  |  121 lines

  1. # Makefile for "file" (tested with dmake 3.8)                   6 April 1993
  2. #
  3. # - for GNU gcc (emx kit) under OS/2 2.0 (32-bit)
  4. # - for Microsoft C 6.00 under OS/2 or MSDOS (16-bit)
  5.  
  6. # To use, enter "{d,n}make -f makefile.os2" (this makefile depends on its
  7. # name being "makefile.os2").
  8.  
  9. # Notes on Microsoft C 6.00A compilation:
  10. # The msc target creates an OS/2-only executable with additional features
  11. # over the mscdos version.  Notes from the unzip package suggest that 
  12. # a larger stack has to be used for OS/2 because system calls use more 
  13. # stack than under DOS; 8k is recommended by Microsoft.
  14.  
  15. default:
  16.     @echo Enter "$(MAKE) -f makefile.os2 emx"
  17.     @echo    or "$(MAKE) -f makefile.os2 msc"
  18.     @echo    or "$(MAKE) -f makefile.os2 mscdos"
  19.  
  20. emx:
  21.     $(MAKE) -f makefile.os2 all \
  22.     CC="gcc -Zomf -Zmtd" O=".obj" \
  23.     CFLAGS="-DOS2 -DEMX" \
  24.     LDFLAGS="" \
  25.     LDFLAGS2="" \
  26.     OBJS2="" \
  27.     DEF="file-32.def"
  28.  
  29. msc:
  30.     $(MAKE) -f makefile.os2 all \
  31.     CC="cl -nologo -AC" O=".obj" \
  32.     CFLAGS="-D__STDC__ -DOS2 -DMSC -UMSDOS" \
  33.     LDFLAGS="-Lp -F 4000" \
  34.     LDFLAGS2="setargv.obj -link /NOE" \
  35.     OBJS2="getopt$$O _getname$$O" \
  36.     DEF="file.def"
  37.  
  38. mscdos:
  39.     $(MAKE) -f makefile.os2 all \
  40.     CC="cl -nologo -AC" O=".obj" \
  41.     CFLAGS="-D__STDC__ -DOS2 -DMSC -DNO_PIPE" \
  42.     LDFLAGS="-Lr -F 4000" \
  43.     LDFLAGS2="setargv.obj -link /NOE" \
  44.     OBJS2="getopt$$O _getname$$O" \
  45.     DEF=""
  46.  
  47.  
  48. MAGIC = /etc/magic
  49.  
  50. MANCDIR    = /etc/man/man1
  51. MANCEXT    = 1
  52. MANFDIR    = /etc/man/man4
  53. MANFEXT    = 4
  54.  
  55. # There are no system-dependant configuration options (except maybe CFLAGS).
  56. # Uncomment any of these that is missing from your "standard" library.
  57. LOCALSRCS = # localsrc/getopt.c localsrc/strtol.c \
  58. #        localsrc/strtok.c localsrc/strchr.c
  59. LOCALOBJS = # localsrc/getopt$O localsrc/strtol$O \
  60. #        localsrc/strtok$O localsrc/strchr$O
  61. # These are not compiled in unless you use -Ilocalinc, but
  62. # are not commented out as "make dist" &c use them.
  63. LOCALINC = localinc/*.h localinc/sys/*.h
  64.  
  65.  
  66. .c$O :
  67.     $(CC) $(CFLAGS) -c $<
  68.  
  69. SRCS = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \
  70.     compress.c is_tar.c \
  71.     print.c $(LOCALSRCS) $(LOCALINC) apptype.c _getname.c
  72. OBJS = file$O apprentice$O fsmagic$O softmagic$O ascmagic$O \
  73.     compress$O is_tar$O \
  74.     print$O $(LOCALOBJS) apptype$O $(OBJS2)
  75.  
  76. ALLSRC = LEGAL.NOTICE README MAINT PORTING $(SRCS) *.h \
  77.     Makefile file.1s magic.4s localsrc/*.c tst/Makefile
  78. ALLMAGIC =   Magdir/Makefile Magdir/Localstuff Magdir/Header Magdir/[a-z]*
  79.  
  80. all:        file.exe magic
  81.  
  82. TESTFILES = * tst/*
  83. try:        all $(OFILE)
  84.         cd tst; make
  85.         time $(OFILE) $(TESTFILES) >/tmp/t1 # can't use ./magic
  86.         time ./file -m ./magic $(TESTFILES) >/tmp/t2
  87.         -diff -b /tmp/t[12]
  88.         what ./file >lastnocore
  89.  
  90. file.exe :    $(OBJS) $(DEF)
  91.         $(CC) $(LDFLAGS) -o $@ $< $(LDFLAGS2)
  92.  
  93. magic:        Magdir
  94. #        Magdir/Makefile's "install" mv's magic to here for testing.
  95. [
  96. cd Magdir
  97. make install
  98. ]
  99.  
  100. ascmagic$O:    names.h
  101.  
  102. apprentice$O ascmagic$O file$O fsmagic$O print$O softmagic$O: file.h
  103.  
  104. install:    file.exe magic file.1 magic.4 $(BINDIR) $(MANCDIR) $(MANFDIR)
  105.         cp file        $(BINDIR)/file
  106.         cp magic    $(MAGIC)
  107.         cp file.1    $(MANCDIR)/file.$(MANCEXT)
  108.         cp magic.4    $(MANFDIR)/magic.$(MANFEXT)
  109.  
  110. file.1 magic.4 : file.1s magic.4s Makefile.os2
  111.     sed -e s,__MAGIC__,$(MAGIC),g -e s,__SECTION__,$(MANFEXT),g $@s > $@
  112.  
  113. clean:
  114.         rm -f *$O core file.exe magic lint dist.* MANIFEST lastnocore
  115. clobber:
  116.         cd tst; make clean
  117.  
  118. tar:        $(ALLSRC) $(ALLMAGIC)
  119.         tar cvf /dev/rfd0a $(ALLSRC) $(ALLMAGIC)
  120.  
  121.