Makefile.gcc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. # Makefile for zlib, derived from Makefile.dj2.
  2. # Modified for mingw32 by C. Spieler, 6/16/98.
  3. # Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003.
  4. # Last updated: 1-Aug-2003.
  5. # Tested under Cygwin and MinGW.
  6. # Copyright (C) 1995-2003 Jean-loup Gailly.
  7. # For conditions of distribution and use, see copyright notice in zlib.h
  8. # To compile, or to compile and test, type:
  9. #
  10. # make -fmakefile.gcc; make test testdll -fmakefile.gcc
  11. #
  12. # To use the asm code, type:
  13. # cp contrib/asm?86/match.S ./match.S
  14. # make LOC=-DASMV OBJA=match.o -fmakefile.gcc
  15. #
  16. # To install libz.a, zconf.h and zlib.h in the system directories, type:
  17. #
  18. # make install -fmakefile.gcc
  19. # Note:
  20. # If the platform is *not* MinGW (e.g. it is Cygwin or UWIN),
  21. # the DLL name should be changed from "zlib1.dll".
  22. STATICLIB = libz.a
  23. SHAREDLIB = zlib1.dll
  24. IMPLIB = libzdll.a
  25. #
  26. # Set to 1 if shared object needs to be installed
  27. #
  28. SHARED_MODE=0
  29. #LOC = -DASMV
  30. #LOC = -DDEBUG -g
  31. PREFIX =
  32. CC = $(PREFIX)gcc
  33. CFLAGS = $(LOC) -O3 -Wall
  34. EXTRA_CFLAGS = -DNO_VIZ
  35. AS = $(CC)
  36. ASFLAGS = $(LOC) -Wall
  37. LD = $(CC)
  38. LDFLAGS = $(LOC)
  39. AR = $(PREFIX)ar
  40. ARFLAGS = rcs
  41. RC = $(PREFIX)windres
  42. RCFLAGS = --define GCC_WINDRES
  43. STRIP = $(PREFIX)strip
  44. CP = cp -fp
  45. # If GNU install is available, replace $(CP) with install.
  46. INSTALL = $(CP)
  47. RM = rm -f
  48. prefix = /usr/local
  49. exec_prefix = $(prefix)
  50. OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
  51. gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
  52. OBJA =
  53. all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe
  54. test: example.exe minigzip.exe
  55. ./example
  56. echo hello world | ./minigzip | ./minigzip -d
  57. testdll: example_d.exe minigzip_d.exe
  58. ./example_d
  59. echo hello world | ./minigzip_d | ./minigzip_d -d
  60. .c.o:
  61. $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -c -o $@ $<
  62. .S.o:
  63. $(AS) $(ASFLAGS) -c -o $@ $<
  64. $(STATICLIB): $(OBJS) $(OBJA)
  65. $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA)
  66. $(IMPLIB): $(SHAREDLIB)
  67. $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
  68. $(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \
  69. -o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
  70. $(STRIP) $@
  71. example.exe: example.o $(STATICLIB)
  72. $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
  73. $(STRIP) $@
  74. minigzip.exe: minigzip.o $(STATICLIB)
  75. $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB)
  76. $(STRIP) $@
  77. example_d.exe: example.o $(IMPLIB)
  78. $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB)
  79. $(STRIP) $@
  80. minigzip_d.exe: minigzip.o $(IMPLIB)
  81. $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB)
  82. $(STRIP) $@
  83. zlibrc.o: win32/zlib1.rc
  84. $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc
  85. # BINARY_PATH, INCLUDE_PATH and LIBRARY_PATH must be set.
  86. .PHONY: install uninstall clean
  87. install: zlib.h zconf.h $(STATICLIB) $(IMPLIB)
  88. -@mkdir -p $(INCLUDE_PATH)
  89. -@mkdir -p $(LIBRARY_PATH)
  90. -if [ "$(SHARED_MODE)" = "1" ]; then \
  91. mkdir -p $(BINARY_PATH); \
  92. $(INSTALL) $(SHAREDLIB) $(BINARY_PATH); \
  93. $(INSTALL) $(IMPLIB) $(LIBRARY_PATH); \
  94. fi
  95. -$(INSTALL) zlib.h $(INCLUDE_PATH)
  96. -$(INSTALL) zconf.h $(INCLUDE_PATH)
  97. -$(INSTALL) $(STATICLIB) $(LIBRARY_PATH)
  98. uninstall:
  99. -if [ "$(SHARED_MODE)" = "1" ]; then \
  100. $(RM) $(BINARY_PATH)/$(SHAREDLIB); \
  101. $(RM) $(LIBRARY_PATH)/$(IMPLIB); \
  102. fi
  103. -$(RM) $(INCLUDE_PATH)/zlib.h
  104. -$(RM) $(INCLUDE_PATH)/zconf.h
  105. -$(RM) $(LIBRARY_PATH)/$(STATICLIB)
  106. clean:
  107. -$(RM) $(STATICLIB)
  108. -$(RM) $(SHAREDLIB)
  109. -$(RM) $(IMPLIB)
  110. -$(RM) *.o
  111. -$(RM) *.exe
  112. -$(RM) foo.gz
  113. adler32.o: zlib.h zconf.h
  114. compress.o: zlib.h zconf.h
  115. crc32.o: crc32.h zlib.h zconf.h
  116. deflate.o: deflate.h zutil.h zlib.h zconf.h
  117. example.o: zlib.h zconf.h
  118. gzclose.o: zlib.h zconf.h gzguts.h
  119. gzlib.o: zlib.h zconf.h gzguts.h
  120. gzread.o: zlib.h zconf.h gzguts.h
  121. gzwrite.o: zlib.h zconf.h gzguts.h
  122. inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
  123. inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
  124. infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
  125. inftrees.o: zutil.h zlib.h zconf.h inftrees.h
  126. minigzip.o: zlib.h zconf.h
  127. trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
  128. uncompr.o: zlib.h zconf.h
  129. zutil.o: zutil.h zlib.h zconf.h