Makefile.msc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. # Makefile for zlib using Microsoft (Visual) C
  2. # zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler
  3. #
  4. # Usage:
  5. # nmake -f win32/Makefile.msc (standard build)
  6. # nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build)
  7. # nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" \
  8. # OBJA="inffas32.obj match686.obj" (use ASM code, x86)
  9. # nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -I." \
  10. # OBJA="inffasx64.obj gvmat64.obj inffas8664.obj" (use ASM code, x64)
  11. # optional build flags
  12. LOC =
  13. # variables
  14. STATICLIB = zlib.lib
  15. SHAREDLIB = zlib1.dll
  16. IMPLIB = zdll.lib
  17. CC = cl
  18. AS = ml
  19. LD = link
  20. AR = lib
  21. RC = rc
  22. CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC)
  23. WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
  24. ASFLAGS = -coff -Zi $(LOC)
  25. LDFLAGS = -nologo -debug -incremental:no -opt:ref
  26. ARFLAGS = -nologo
  27. RCFLAGS = /dWIN32 /r
  28. OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj \
  29. gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj
  30. OBJA =
  31. # targets
  32. all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
  33. example.exe minigzip.exe example_d.exe minigzip_d.exe
  34. $(STATICLIB): $(OBJS) $(OBJA)
  35. $(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA)
  36. $(IMPLIB): $(SHAREDLIB)
  37. $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlib1.res
  38. $(LD) $(LDFLAGS) -def:win32/zlib.def -dll -implib:$(IMPLIB) \
  39. -out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res
  40. if exist $@.manifest \
  41. mt -nologo -manifest $@.manifest -outputresource:$@;2
  42. example.exe: example.obj $(STATICLIB)
  43. $(LD) $(LDFLAGS) example.obj $(STATICLIB)
  44. if exist $@.manifest \
  45. mt -nologo -manifest $@.manifest -outputresource:$@;1
  46. minigzip.exe: minigzip.obj $(STATICLIB)
  47. $(LD) $(LDFLAGS) minigzip.obj $(STATICLIB)
  48. if exist $@.manifest \
  49. mt -nologo -manifest $@.manifest -outputresource:$@;1
  50. example_d.exe: example.obj $(IMPLIB)
  51. $(LD) $(LDFLAGS) -out:$@ example.obj $(IMPLIB)
  52. if exist $@.manifest \
  53. mt -nologo -manifest $@.manifest -outputresource:$@;1
  54. minigzip_d.exe: minigzip.obj $(IMPLIB)
  55. $(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB)
  56. if exist $@.manifest \
  57. mt -nologo -manifest $@.manifest -outputresource:$@;1
  58. .c.obj:
  59. $(CC) -c $(WFLAGS) $(CFLAGS) $<
  60. {test}.c.obj:
  61. $(CC) -c -I. $(WFLAGS) $(CFLAGS) $<
  62. {contrib/masmx64}.c.obj:
  63. $(CC) -c $(WFLAGS) $(CFLAGS) $<
  64. {contrib/masmx64}.asm.obj:
  65. $(AS) -c $(ASFLAGS) $<
  66. {contrib/masmx86}.asm.obj:
  67. $(AS) -c $(ASFLAGS) $<
  68. adler32.obj: adler32.c zlib.h zconf.h
  69. compress.obj: compress.c zlib.h zconf.h
  70. crc32.obj: crc32.c zlib.h zconf.h crc32.h
  71. deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
  72. gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
  73. gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
  74. gzread.obj: gzread.c zlib.h zconf.h gzguts.h
  75. gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
  76. infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
  77. inffast.h inffixed.h
  78. inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
  79. inffast.h
  80. inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
  81. inffast.h inffixed.h
  82. inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
  83. trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
  84. uncompr.obj: uncompr.c zlib.h zconf.h
  85. zutil.obj: zutil.c zutil.h zlib.h zconf.h
  86. gvmat64.obj: contrib\masmx64\gvmat64.asm
  87. inffasx64.obj: contrib\masmx64\inffasx64.asm
  88. inffas8664.obj: contrib\masmx64\inffas8664.c zutil.h zlib.h zconf.h \
  89. inftrees.h inflate.h inffast.h
  90. inffas32.obj: contrib\masmx86\inffas32.asm
  91. match686.obj: contrib\masmx86\match686.asm
  92. example.obj: test/example.c zlib.h zconf.h
  93. minigzip.obj: test/minigzip.c zlib.h zconf.h
  94. zlib1.res: win32/zlib1.rc
  95. $(RC) $(RCFLAGS) /fo$@ win32/zlib1.rc
  96. # testing
  97. test: example.exe minigzip.exe
  98. example
  99. echo hello world | minigzip | minigzip -d
  100. testdll: example_d.exe minigzip_d.exe
  101. example_d
  102. echo hello world | minigzip_d | minigzip_d -d
  103. # cleanup
  104. clean:
  105. -del $(STATICLIB)
  106. -del $(SHAREDLIB)
  107. -del $(IMPLIB)
  108. -del *.obj
  109. -del *.res
  110. -del *.exp
  111. -del *.exe
  112. -del *.pdb
  113. -del *.manifest
  114. -del foo.gz