home *** CD-ROM | disk | FTP | other *** search
/ PC World 2000 August / PCWorld_2000-08_cd.bin / Software / TemaCD / freedos / full.bin / SOURCE / UNZ532 / BEOS / MAKEFILE < prev    next >
Text File  |  1997-09-22  |  9KB  |  299 lines

  1. #==============================================================================
  2. # Makefile for UnZip, UnZipSFX and fUnZip:  BeOS
  3. # Version:  5.32                                               2 September 1997
  4. #==============================================================================
  5.  
  6. # INSTRUCTIONS (such as they are):
  7. #
  8. # "make list" - lists all supported compilers (targets)
  9. # "make foo"  - makes UnZip in current directory using the foo compiler
  10. #
  11. # CF are flags for the C compiler.  LF are flags for the loader.  LF2 are more
  12. # flags for the loader, if they need to be at the end of the line instead of at
  13. # the beginning (for example, some libraries).  FL and FL2 are the corre-
  14. # sponding flags for fUnZip.  LOCAL_UNZIP is an environment variable that can
  15. # be used to add default C flags to your compile without editing the Makefile
  16. # (e.g., -DDEBUG_STRUC, or -FPi87 on PCs using Microsoft C).
  17. #
  18. # Be sure to test your new UnZip (and UnZipSFX and fUnZip); successful compila-
  19. # tion does not always imply a working program.
  20. #
  21. # You might want to go down to the "installation" section and set the prefix
  22. # to something else; not everyone is as strange as me, and you might not want
  23. # to put your Info-ZIP executables in /boot/usr/local/bin.  [cjh]
  24.  
  25. all:
  26.     @echo ''
  27.     @echo 'Make what?  You must say what compiler you want to use -- '
  28.     @echo 'for example, "make -f beos/Makefile foo".'
  29.     @echo ''
  30.     @echo 'The supported compilers are:'
  31.     @echo ''
  32.     @echo '     gcc     GNU C'
  33.     @echo '     mwcc    Metrowerks CodeWarrior'
  34.     @echo ''
  35.  
  36. list: all
  37.  
  38. #####################
  39. # MACRO DEFINITIONS #
  40. #####################
  41.  
  42. MAKE = make -f beos/Makefile
  43.  
  44. # Defaults most systems use (use LOCAL_UNZIP in environment to add flags,
  45. # such as -DDOSWILD).
  46.  
  47. # UnZip flags
  48. MW_CC  = mwcc
  49. GNU_CC = gcc
  50.  
  51. LD = $(CC)
  52. LOC = $(LOCAL_UNZIP) -DPASSWD_FROM_STDIN
  53. AF = $(LOC)
  54.  
  55. # -ansi strict doesn't work with the AADR9 stdio.h... d'oh!
  56. MW_CF = -w9 -ansi strict -O7 -rostr -I. $(LOC)
  57. MW_LF = -o unzip
  58. MW_LF2 =
  59.  
  60. GNU_CF = -Wall -ansi -mcpu=604 -O3 -I. -I/boot/develop/headers/be/support $(LOC)
  61. GNU_LF = -o unzip
  62. GNU_LF2 =
  63.  
  64. # UnZipSFX flags
  65. SL = -o unzipsfx
  66. SL2 = $(LF2)
  67.  
  68. # fUnZip flags
  69. FL = -o funzip
  70. FL2 = $(LF2)
  71.  
  72. # general-purpose stuff
  73. CP = cp
  74. RM = rm -f
  75. LN = ln -sf
  76. E =
  77. O = .o
  78. M = beos
  79. SHELL = /bin/sh
  80.  
  81. # defaults for crc32 stuff and system-dependent headers
  82. CRC32 = crc32
  83. OSDEP_H = beos/beos.h
  84.  
  85. # object files
  86. OBJS1 = unzip$O $(CRC32)$O crctab$O crypt$O envargs$O explode$O
  87. OBJS2 = extract$O fileio$O globals$O inflate$O list$O match$O
  88. OBJS3 = process$O ttyio$O unreduce$O unshrink$O zipinfo$O
  89. OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $M$O
  90. LOBJS = $(OBJS)
  91. OBJSDLL = $(OBJS) api$O
  92. OBJX = unzipsfx$O $(CRC32)$O crctab$O crypt$O extract_$O fileio$O globals$O \
  93.     inflate$O match$O process_$O ttyio$O $M_$O
  94. LOBJX = $(OBJX)
  95. OBJF = funzip$O $(CRC32)$O crypt_$O globals_$O inflate_$O ttyio_$O
  96. UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
  97.  
  98. # installation
  99. INSTALL = install
  100. # on some systems, manext=l and MANDIR=/usr/man/man$(manext) may be appropriate
  101. manext = 1
  102. prefix = /boot/home/config
  103. BINDIR = $(prefix)/bin#            where to install executables
  104. MANDIR = $(prefix)/man/man$(manext)#    where to install man pages
  105. INSTALLEDBIN = $(BINDIR)/funzip$E $(BINDIR)/zipinfo$E $(BINDIR)/unzipsfx$E \
  106.     $(BINDIR)/unzip$E
  107. INSTALLEDMAN = $(MANDIR)/unzip.$(manext) $(MANDIR)/funzip.$(manext) \
  108.     $(MANDIR)/unzipsfx.$(manext) $(MANDIR)/zipinfo.$(manext)
  109. #
  110. UNZIPS = unzip$E funzip$E unzipsfx$E zipinfo$E
  111. # this is a little ugly...well, no, it's a lot ugly:
  112. MANS = unix/unzip.1 unix/unzipsfx.1 unix/zipinfo.1 unix/funzip.1
  113. DOCS = unzip.doc unzipsfx.doc zipinfo.doc funzip.doc
  114.  
  115. ###############################################
  116. # BASIC COMPILE INSTRUCTIONS AND DEPENDENCIES #
  117. ###############################################
  118.  
  119. # this is for GNU make; comment out and notify zip-bugs if it causes errors
  120. .SUFFIXES:    .c .o
  121.  
  122. # default for compiling C files
  123. .c.o:
  124.     $(CC) -c $(CF) $*.c
  125.  
  126.  
  127. unzips:        $(UNZIPS)
  128. objs:        $(OBJS)
  129. objsdll:    $(OBJSDLL)
  130. docs:        $(DOCS)
  131. unzipsman:    unzips docs
  132. unzipsdocs:    unzips docs
  133.  
  134.  
  135. unzip$E:    $(OBJS)
  136.     $(LD) $(LF) $(LOBJS) $(LF2)
  137.  
  138. unzipsfx$E:    $(OBJX)
  139.     $(LD) $(SL) $(LOBJX) $(SL2)
  140.  
  141. funzip$E:    $(OBJF)
  142.     $(LD) $(FL) $(OBJF) $(FL2)
  143.  
  144. zipinfo$E:    unzip$E
  145.     $(LN) unzip$E zipinfo$E
  146.  
  147.  
  148. crc32$O:    crc32.c $(UNZIP_H) zip.h
  149. crctab$O:    crctab.c $(UNZIP_H) zip.h
  150. crypt$O:    crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
  151. envargs$O:    envargs.c $(UNZIP_H)
  152. explode$O:    explode.c $(UNZIP_H)
  153. extract$O:    extract.c $(UNZIP_H) crypt.h
  154. fileio$O:    fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
  155. funzip$O:    funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h
  156. globals$O:    globals.c $(UNZIP_H)
  157. inflate$O:    inflate.c inflate.h $(UNZIP_H)
  158. list$O:        list.c $(UNZIP_H)
  159. match$O:    match.c $(UNZIP_H)
  160. process$O:    process.c $(UNZIP_H)
  161. ttyio$O:    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  162. unreduce$O:    unreduce.c $(UNZIP_H)
  163. unshrink$O:    unshrink.c $(UNZIP_H)
  164. unzip$O:    unzip.c $(UNZIP_H) crypt.h version.h consts.h
  165. zipinfo$O:    zipinfo.c $(UNZIP_H)
  166.  
  167. crypt_$O:    crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h    # funzip only
  168.     $(CP) crypt.c crypt_.c
  169.     $(CC) -c $(CF) -DFUNZIP crypt_.c
  170.     $(RM) crypt_.c
  171.  
  172. extract_$O:    extract.c $(UNZIP_H) crypt.h            # unzipsfx only
  173.     $(CP) extract.c extract_.c
  174.     $(CC) -c $(CF) -DSFX extract_.c
  175.     $(RM) extract_.c
  176.  
  177. globals_$O:    globals.c $(UNZIP_H)                # funzip only
  178.     $(CP) globals.c globals_.c
  179.     $(CC) -c $(CF) -DFUNZIP globals_.c
  180.     $(RM) globals_.c
  181.  
  182. inflate_$O:    inflate.c inflate.h $(UNZIP_H) crypt.h        # funzip only
  183.     $(CP) inflate.c inflate_.c
  184.     $(CC) -c $(CF) -DFUNZIP inflate_.c
  185.     $(RM) inflate_.c
  186.  
  187. ttyio_$O:    ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h    # funzip only
  188.     $(CP) ttyio.c ttyio_.c
  189.     $(CC) -c $(CF) -DFUNZIP ttyio_.c
  190.     $(RM) ttyio_.c
  191.  
  192. process_$O:    process.c $(UNZIP_H)                # unzipsfx only
  193.     $(CP) process.c process_.c
  194.     $(CC) -c $(CF) -DSFX process_.c
  195.     $(RM) process_.c
  196.  
  197. beos$O:        beos/beos.c $(UNZIP_H) version.h        # BeOS only
  198.     $(CC) -c $(CF) beos/beos.c
  199.  
  200. # version() not used by unzipsfx, so no version.h dependency
  201. beos_$O:        beos/beos.c $(UNZIP_H)                # unzipsfx only
  202.     $(CP) beos/beos.c beos_.c
  203.     $(CC) -c $(CF) -Ibeos -DSFX beos_.c
  204.     $(RM) beos_.c
  205.  
  206. unzipsfx$O:    unzip.c $(UNZIP_H) crypt.h version.h consts.h    # unzipsfx only
  207.     $(CP) unzip.c unzipsfx.c
  208.     $(CC) -c $(CF) -DSFX unzipsfx.c
  209.     $(RM) unzipsfx.c
  210.  
  211.  
  212. # this really only works for Unix targets, unless E and O specified on cmd line
  213. clean:
  214.     -rm -f $(UNZIPS) $(OBJS) $(OBJF) $(OBJX) api$O apihelp$O crc_gcc$O \
  215.       unzipstb$O
  216.  
  217. install:    $(UNZIPS) $(MANS)
  218.     $(INSTALL) -m 755 $(UNZIPS) $(BINDIR)
  219.     $(RM) $(BINDIR)/zipinfo$E
  220.     $(LN) unzip$E $(BINDIR)/zipinfo$E
  221.     $(RM) $(BINDIR)/zipgrep$E
  222.     $(INSTALL) -m 755 unix/zipgrep $(BINDIR)/zipgrep$E
  223.     $(INSTALL) -m 644 unix/unzip.1 $(MANDIR)/unzip.$(manext)
  224.     $(INSTALL) -m 644 unix/unzipsfx.1 $(MANDIR)/unzipsfx.$(manext)
  225.     $(INSTALL) -m 644 unix/zipinfo.1 $(MANDIR)/zipinfo.$(manext)
  226.     $(INSTALL) -m 644 unix/funzip.1 $(MANDIR)/funzip.$(manext)
  227.     $(INSTALL) -m 644 $(DOCS) $(MANDIR)
  228.  
  229. # alternatively, could use zip method:  -cd $(BINDIR); rm -f $(UNZIPS)  [etc.]
  230. uninstall:
  231.     rm -f $(INSTALLEDBIN) $(INSTALLEDMAN)
  232.  
  233.  
  234. TESTZIP = testmake.zip    # the test zipfile
  235.  
  236. # test some basic features of the build
  237. test:        check
  238.  
  239. check:    unzips
  240.     @echo '  This is a Unix-specific target.  (Just so you know.)'
  241.     @echo '  (Should work ok on BeOS... [cjh])'
  242.     if test ! -f $(TESTZIP); then \
  243.         echo "  error:  can't find test file $(TESTZIP)"; exit 1; fi
  244. #
  245.     echo "  testing extraction"
  246.     ./unzip -b $(TESTZIP) testmake.zipinfo
  247.     if test $? ; then \
  248.         echo "  error:  file extraction from $(TESTZIP) failed"; exit 1; fi
  249. #
  250.     echo '  testing zipinfo (unzip -Z)'
  251.     ./unzip -Z $(TESTZIP) > testmake.unzip-Z
  252.     if diff testmake.unzip-Z testmake.zipinfo; then ;; else \
  253.         echo '  error:  zipinfo output doesn't match stored version'; fi
  254.     $(RM) testmake.unzip-Z testmake.zipinfo
  255. #
  256.     echo '  testing unzip -d exdir option'
  257.     ./unzip -b $(TESTZIP) -d testun
  258.     cat testun/notes
  259. #
  260.     echo '  testing unzip -o and funzip (ignore funzip warning)'
  261.     ./unzip -boq $(TESTZIP) notes -d testun
  262.     ./funzip < $(TESTZIP) > testun/notes2
  263.     if diff testun/notes testun/notes2; then ;; else \
  264.         echo 'error:  funzip output disagrees with unzip'; fi
  265. #
  266.     echo '  testing unzipsfx (self-extractor)'
  267.     cat unzipsfx $(TESTZIP) > testsfx
  268.     $(CHMOD) 0700 testsfx
  269.     ./testsfx -b notes
  270.     if diff notes testun/notes; then ;; else \
  271.         echo '  error:  unzipsfx file disagrees with unzip'; fi
  272.     $(RM) testsfx notes testun/notes testun/notes2
  273.     rmdir testun
  274. #
  275.     echo '  testing complete.'
  276.  
  277. ######################################################################
  278. # Make rules for the supported compilers
  279.  
  280. gnu: gcc
  281.  
  282. gnuc: gcc
  283.  
  284. gcc:
  285.     @echo 'Making with GNU C...'
  286.     @echo ''
  287.     $(MAKE) $(UNZIPS) CC=$(GNU_CC) CF="$(GNU_CF)" LF="$(GNU_LF)" \
  288.             LF2="$(GNU_LF2)"
  289.  
  290. mwcc:
  291.     @echo 'Making with Metrowerks CodeWarrior...'
  292.     @echo ''
  293.     $(MAKE) $(UNZIPS) CC=$(MW_CC) CF="$(MW_CF)" LF="$(MW_LF)" \
  294.             LF2="$(MW_LF2)"
  295.  
  296. foo: list
  297.     @echo 'I was kidding about the "foo" compiler.'
  298.     @echo ''
  299.