Makefile.emx 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  1. # Makefile for UnZip, fUnZip and UnZipSFX
  2. # for emx 0.9d + rsxnt 1.42 / gcc under WIN32. Derived from makefile.os2
  3. # By E-Yen Tan and Christian Spieler. Last updated 25 December 2006.
  4. #
  5. # This makefile should work fine with GNU make and hopefully some others.
  6. # Tested with Spieler's special GNU make 3.74 gnuish 16-bit version.
  7. #
  8. # If make does not support long command-line passing to gcc, the link step
  9. # will fail. In this case, you have to edit the link commands to use the
  10. # commented-out alternative that creates a link response file "by hand".
  11. #ifdef NOASM
  12. #AS_FLAGS =
  13. #else
  14. AS_FLAGS = -DASM_CRC
  15. #endif
  16. CP=copy
  17. RM=del
  18. CC=gcc -Zwin32 -I.
  19. CC_OSIZ=-O1
  20. CC_OTIM=-O2 -mpentium
  21. CC_OPTS=-Wall -DWIN32 $(AS_FLAGS) $(LOCAL_UNZIP)
  22. CFLAGS=$(CC_OTIM) $(CC_OPTS)
  23. CFLAGSX=$(CC_OSIZ) $(CC_OPTS) -DSFX
  24. CFLAGSF=$(CC_OTIM) $(CC_OPTS) -DFUNZIP
  25. DLLFLAG=
  26. AS=gcc
  27. ASFLAGS=-Di386
  28. LDFLAGS=-Zsys -o ./
  29. LDFLAGS2=-ladvapi32 -Zsmall-conv -s
  30. OUT=-o
  31. OBJ=.o
  32. #ifdef NOASM
  33. #CRCA_O=
  34. #else
  35. CRCA_O=crc_gcc
  36. #endif
  37. OBJUS=win32$(OBJ) nt$(OBJ)
  38. OBJXS=win32_$(OBJ) nt_$(OBJ)
  39. OBJFS=win32f$(OBJ)
  40. OSDEP_H=win32/w32cfg.h
  41. # default settings for target dependent macros:
  42. DIRSEP = /
  43. AS_DIRSEP = /
  44. OBJU1 = unzip$(OBJ) crc32$(OBJ) $(CRCA_O) crypt$(OBJ) envargs$(OBJ)
  45. OBJU2 = explode$(OBJ) extract$(OBJ) fileio$(OBJ) globals$(OBJ)
  46. OBJU3 = inflate$(OBJ) list$(OBJ) match$(OBJ) process$(OBJ) ttyio$(OBJ)
  47. OBJU4 = ubz2err$(OBJ) unreduce$(OBJ) unshrink$(OBJ) zipinfo$(OBJ)
  48. OBJU = $(OBJU1) $(OBJU2) $(OBJU3) $(OBJU4) $(OBJUS)
  49. OBJX1 = unzipsf_$(OBJ) crc32_$(OBJ) $(CRCA_O) crypt_$(OBJ)
  50. OBJX2 = extract_$(OBJ) fileio_$(OBJ) globals_$(OBJ) inflate_$(OBJ)
  51. OBJX3 = match_$(OBJ) process_$(OBJ) ttyio_$(OBJ) ubz2err_$(OBJ)
  52. OBJX = $(OBJX1) $(OBJX2) $(OBJX3) $(OBJXS)
  53. OBJF = funzip$(OBJ) crc32f$(OBJ) $(CRCA_O) cryptf$(OBJ) inflatef$(OBJ) \
  54. globalsf$(OBJ) ttyiof$(OBJ) $(OBJFS)
  55. UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)
  56. # rules
  57. .SUFFIXES: .c $(OBJ)
  58. .c$(OBJ):
  59. $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ $<
  60. # targets
  61. all: unzip.exe funzip.exe unzipsfx.exe
  62. # This next bit is nasty, but is needed to overcome the MS-DOS command
  63. # line limit as response files for emx's gcc seem to only work if each
  64. # file is on a different line. DJGPP doesn't do this (if you are at all
  65. # interested).
  66. unzip.exe: $(OBJU)
  67. # @ echo off
  68. # -@ $(RM) unzip.rsp
  69. # @ for %f in ($(OBJU1)) do echo %f >> unzip.rsp
  70. # @ for %f in ($(OBJU2)) do echo %f >> unzip.rsp
  71. # @ for %f in ($(OBJU3)) do echo %f >> unzip.rsp
  72. # @ for %f in ($(OBJU4) $(OBJUS)) do echo %f >> unzip.rsp
  73. # $(CC) $(LDFLAGS)$@ $(DEF) @unzip.rsp $(LDFLAGS2)
  74. $(CC) $(LDFLAGS)$@ $(DEF) $(OBJU) $(LDFLAGS2)
  75. # @ $(RM) unzip.rsp
  76. funzip.exe: $(OBJF)
  77. $(CC) $(LDFLAGS)$@ $(DEF) $(OBJF) $(LDFLAGS2)
  78. unzipsfx.exe: $(OBJX)
  79. # @ echo off
  80. # -@ $(RM) unzipsfx.rsp
  81. # @ for %f in ($(OBJX1)) do echo %f >> unzipsfx.rsp
  82. # @ for %f in ($(OBJX2)) do echo %f >> unzipsfx.rsp
  83. # @ for %f in ($(OBJX3)) do echo %f >> unzipsfx.rsp
  84. # @ for %f in ($(OBJXS)) do echo %f >> unzipsfx.rsp
  85. # $(CC) $(LDFLAGS)$@ $(DEF) @unzipsfx.rsp $(LDFLAGS2)
  86. $(CC) $(LDFLAGS)$@ $(DEF) $(OBJX) $(LDFLAGS2)
  87. # @ $(RM) unzipsfx.rsp
  88. uzexampl.exe: uzexampl$(OBJ)
  89. $(CC) $(LDFLAGS)$@ $(DEF) uzexampl$(OBJ) -lversion $(LDFLAGS2)
  90. # dependencies
  91. apihelp$(OBJ): apihelp.c $(UNZIP_H) unzvers.h
  92. crc32$(OBJ): crc32.c $(UNZIP_H) zip.h crc32.h
  93. envargs$(OBJ): envargs.c $(UNZIP_H)
  94. explode$(OBJ): explode.c $(UNZIP_H)
  95. extract$(OBJ): extract.c $(UNZIP_H) crc32.h crypt.h
  96. fileio$(OBJ): fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  97. globals$(OBJ): globals.c $(UNZIP_H)
  98. inflate$(OBJ): inflate.c $(UNZIP_H)
  99. list$(OBJ): list.c $(UNZIP_H)
  100. match$(OBJ): match.c $(UNZIP_H)
  101. process$(OBJ): process.c $(UNZIP_H) crc32.h
  102. ttyio$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  103. ubz2err$(OBJ): ubz2err.c $(UNZIP_H)
  104. unreduce$(OBJ): unreduce.c $(UNZIP_H)
  105. unshrink$(OBJ): unshrink.c $(UNZIP_H)
  106. unzip$(OBJ): unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  107. api$(OBJ): api.c $(UNZIP_H) unzvers.h
  108. zipinfo$(OBJ): zipinfo.c $(UNZIP_H)
  109. funzip$(OBJ): funzip.c $(UNZIP_H) crc32.h crypt.h ttyio.h # funzip only
  110. $(CC) -c $(CFLAGS) $(OUT)$@ funzip.c
  111. unzipstb$(OBJ): unzipstb.c # DLL version
  112. $(CC) -c $(CFLAGS) $(OUT)$@ unzipstb.c
  113. uzexampl$(OBJ): windll/uzexampl.c windll/uzexampl.h # WINDLL example
  114. $(CC) -c $(CFLAGS) $(OUT)$@ windll/uzexampl.c
  115. win32$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h unzvers.h # win32 only
  116. $(CC) -c $(CFLAGS) $(OUT)$@ win32$(DIRSEP)win32.c
  117. win32f$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h # win32 funzip
  118. $(CC) -c $(CFLAGSF) $(OUT)$@ win32$(DIRSEP)win32.c
  119. win32_$(OBJ): win32/win32.c $(UNZIP_H) win32/nt.h # win32 unzipsfx
  120. $(CC) -c $(CFLAGSX) $(OUT)$@ win32$(DIRSEP)win32.c
  121. nt$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h # win32 only
  122. $(CC) -c $(CFLAGS) $(OUT)$@ win32$(DIRSEP)nt.c
  123. nt_$(OBJ): win32/nt.c $(UNZIP_H) win32/nt.h # win32 only
  124. $(CC) -c $(CFLAGSX) $(OUT)$@ win32$(DIRSEP)nt.c
  125. os2$(OBJ): os2/os2.c $(UNZIP_H) unzvers.h # OS/2 only
  126. $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ os2$(DIRSEP)os2.c
  127. os2_$(OBJ): os2/os2.c $(UNZIP_H) # OS/2 unzipsfx
  128. $(CC) -c $(CFLAGSX) $(OUT)$@ os2$(DIRSEP)os2.c
  129. os2acl$(OBJ): os2/os2acl.c $(UNZIP_H) unzvers.h # OS/2 only
  130. $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ os2$(DIRSEP)os2acl.c
  131. rexxhelp$(OBJ): os2/rexxhelp.c # OS/2 DLL only
  132. $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ os2$(DIRSEP)rexxhelp.c
  133. rexxapi$(OBJ): os2/rexxapi.c # OS/2 DLL only
  134. $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ os2$(DIRSEP)rexxapi.c
  135. crc_i86$(OBJ): msdos/crc_i86.asm # 16bit only
  136. $(AS) $(ASFLAGS) msdos$(AS_DIRSEP)crc_i86.asm $(ASEOL)
  137. crc_i386$(OBJ): win32/crc_i386.asm # 32bit, MASM
  138. $(AS) $(ASFLAGS) win32$(AS_DIRSEP)crc_i386.asm $(ASEOL)
  139. crc_gcc$(OBJ): crc_i386.S # 32bit, GNU AS
  140. $(AS) $(ASFLAGS) -x assembler-with-cpp -c -o $@ crc_i386.S
  141. crypt$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  142. $(CC) -c $(CFLAGS) $(DLLFLAG) $(OUT)$@ crypt.c
  143. # funzip compilation section
  144. cryptf$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  145. $(CC) -c $(CFLAGSF) $(OUT)$@ crypt.c
  146. crc32f$(OBJ): crc32.c $(UNZIP_H) zip.h crc32.h
  147. $(CC) -c $(CFLAGSF) $(OUT)$@ crc32.c
  148. globalsf$(OBJ): globals.c $(UNZIP_H)
  149. $(CC) -c $(CFLAGSF) $(OUT)$@ globals.c
  150. inflatef$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h
  151. $(CC) -c $(CFLAGSF) $(OUT)$@ inflate.c
  152. ttyiof$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  153. $(CC) -c $(CFLAGSF) $(OUT)$@ ttyio.c
  154. # unzipsfx compilation section
  155. crc32_$(OBJ): crc32.c $(UNZIP_H) zip.h crc32.h
  156. $(CC) -c $(CFLAGSX) $(OUT)$@ crc32.c
  157. crypt_$(OBJ): crypt.c $(UNZIP_H) zip.h crypt.h crc32.h ttyio.h
  158. $(CC) -c $(CFLAGSX) $(OUT)$@ crypt.c
  159. extract_$(OBJ): extract.c $(UNZIP_H) crc32.h crypt.h
  160. $(CC) -c $(CFLAGSX) $(OUT)$@ extract.c
  161. fileio_$(OBJ): fileio.c $(UNZIP_H) crc32.h crypt.h ttyio.h ebcdic.h
  162. $(CC) -c $(CFLAGSX) $(OUT)$@ fileio.c
  163. globals_$(OBJ): globals.c $(UNZIP_H)
  164. $(CC) -c $(CFLAGSX) $(OUT)$@ globals.c
  165. inflate_$(OBJ): inflate.c inflate.h $(UNZIP_H) crypt.h
  166. $(CC) -c $(CFLAGSX) $(OUT)$@ inflate.c
  167. match_$(OBJ): match.c $(UNZIP_H)
  168. $(CC) -c $(CFLAGSX) $(OUT)$@ match.c
  169. process_$(OBJ): process.c $(UNZIP_H) crc32.h
  170. $(CC) -c $(CFLAGSX) $(OUT)$@ process.c
  171. ttyio_$(OBJ): ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
  172. $(CC) -c $(CFLAGSX) $(OUT)$@ ttyio.c
  173. ubz2err_$(OBJ): ubz2err.c $(UNZIP_H)
  174. $(CC) -c $(CFLAGSX) $(OUT)$@ ubz2err.c
  175. unzipsf_$(OBJ): unzip.c $(UNZIP_H) crypt.h unzvers.h consts.h
  176. $(CC) -c $(CFLAGSX) $(OUT)$@ unzip.c