home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 6 File / 06-File.zip / FILE39.ZIP / Makefile.os2 < prev    next >
Makefile  |  1993-04-10  |  4KB  |  124 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 -Zmt " \
  23.     CFLAGS="-DOS2 -DEMX" \
  24.     LDFLAGS="" \
  25.     LDFLAGS2="" \
  26.     O=".obj" \
  27.     OBJS2="" \
  28.     DEF="file.def"
  29.  
  30. msc:
  31.     $(MAKE) -f makefile.os2 all \
  32.     CC="cl -AC " \
  33.     CFLAGS="-D__STDC__ -DOS2 -DMSC -UMSDOS" \
  34.     LDFLAGS="-Lp -F 4000" \
  35.     LDFLAGS2="setargv.obj -link /NOE" \
  36.     O=".obj" \
  37.     OBJS2="getopt$$O _getname$$O" \
  38.     DEF="file.def"
  39.  
  40. mscdos:
  41.     $(MAKE) -f makefile.os2 all \
  42.     CC="cl -AC " \
  43.     CFLAGS="-D__STDC__ -DOS2 -DMSC -DNO_PIPE" \
  44.     LDFLAGS="-Lr -F 4000" \
  45.     LDFLAGS2="setargv.obj -link /NOE" \
  46.     O=".obj" \
  47.     OBJS2="getopt$$O _getname$$O" \
  48.     DEF=""
  49.  
  50.  
  51. MAGIC = /etc/magic
  52.  
  53. MANCDIR    = /etc/man/man1
  54. MANCEXT    = 1
  55. MANFDIR    = /etc/man/man4
  56. MANFEXT    = 4
  57.  
  58. # There are no system-dependant configuration options (except maybe CFLAGS).
  59. # Uncomment any of these that is missing from your "standard" library.
  60. LOCALSRCS = # localsrc/getopt.c localsrc/strtol.c \
  61. #        localsrc/strtok.c localsrc/strchr.c
  62. LOCALOBJS = # localsrc/getopt$O localsrc/strtol$O \
  63. #        localsrc/strtok$O localsrc/strchr$O
  64. # These are not compiled in unless you use -Ilocalinc, but
  65. # are not commented out as "make dist" &c use them.
  66. LOCALINC = localinc/*.h localinc/sys/*.h
  67.  
  68.  
  69. .c$O :
  70.     $(CC) $(CFLAGS) -c $<
  71.  
  72. SRCS = file.c apprentice.c fsmagic.c softmagic.c ascmagic.c \
  73.     compress.c is_tar.c \
  74.     print.c $(LOCALSRCS) $(LOCALINC) apptype.c _getname.c
  75. OBJS = file$O apprentice$O fsmagic$O softmagic$O ascmagic$O \
  76.     compress$O is_tar$O \
  77.     print$O $(LOCALOBJS) apptype$O $(OBJS2)
  78.  
  79. ALLSRC = LEGAL.NOTICE README MAINT PORTING $(SRCS) *.h \
  80.     Makefile file.1s magic.4s localsrc/*.c tst/Makefile
  81. ALLMAGIC =   Magdir/Makefile Magdir/Localstuff Magdir/Header Magdir/[a-z]*
  82.  
  83. all:        file.exe magic
  84.  
  85. TESTFILES = * tst/*
  86. try:        all $(OFILE)
  87.         cd tst; make
  88.         time $(OFILE) $(TESTFILES) >/tmp/t1 # can't use ./magic
  89.         time ./file -m ./magic $(TESTFILES) >/tmp/t2
  90.         -diff -b /tmp/t[12]
  91.         what ./file >lastnocore
  92.  
  93. file.exe :    $(OBJS) $(DEF)
  94.         $(CC) $(LDFLAGS) -o $@ $< $(LDFLAGS2)
  95.  
  96. magic:        Magdir
  97. #        Magdir/Makefile's "install" mv's magic to here for testing.
  98. [
  99. cd Magdir
  100. make install
  101. ]
  102.  
  103. ascmagic$O:    names.h
  104.  
  105. apprentice$O ascmagic$O file$O fsmagic$O print$O softmagic$O: file.h
  106.  
  107. install:    file.exe magic file.1 magic.4 $(BINDIR) $(MANCDIR) $(MANFDIR)
  108.         cp file        $(BINDIR)/file
  109.         cp magic    $(MAGIC)
  110.         cp file.1    $(MANCDIR)/file.$(MANCEXT)
  111.         cp magic.4    $(MANFDIR)/magic.$(MANFEXT)
  112.  
  113. file.1 magic.4 : file.1s magic.4s Makefile.os2
  114.     sed -e s,__MAGIC__,$(MAGIC),g -e s,__SECTION__,$(MANFEXT),g $@s > $@
  115.  
  116. clean:
  117.         rm -f *$O core file.exe magic lint dist.* MANIFEST lastnocore
  118. clobber:
  119.         cd tst; make clean
  120.  
  121. tar:        $(ALLSRC) $(ALLMAGIC)
  122.         tar cvf /dev/rfd0a $(ALLSRC) $(ALLMAGIC)
  123.  
  124.