Makefile.msc 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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" \
  10. # OBJA="inffasx64.obj gvmat64.obj inffas8664.c" (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 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. {contrib/masmx64}.c.obj:
  61. $(CC) -c $(WFLAGS) $(CFLAGS) $<
  62. {contrib/masmx64}.asm.obj:
  63. $(AS) -c $(ASFLAGS) $<
  64. {contrib/masmx86}.asm.obj:
  65. $(AS) -c $(ASFLAGS) $<
  66. adler32.obj: adler32.c zlib.h zconf.h
  67. compress.obj: compress.c zlib.h zconf.h
  68. crc32.obj: crc32.c zlib.h zconf.h crc32.h
  69. deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
  70. gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
  71. gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
  72. gzread.obj: gzread.c zlib.h zconf.h gzguts.h
  73. gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
  74. infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
  75. inffast.h inffixed.h
  76. inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
  77. inffast.h
  78. inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
  79. inffast.h inffixed.h
  80. inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
  81. trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
  82. uncompr.obj: uncompr.c zlib.h zconf.h
  83. zutil.obj: zutil.c zutil.h zlib.h zconf.h
  84. gvmat64.obj: contrib\masmx64\gvmat64.asm
  85. inffasx64.obj: contrib\masmx64\inffasx64.asm
  86. inffas8664.obj: contrib\masmx64\inffas8664.c zutil.h zlib.h zconf.h \
  87. inftrees.h inflate.h inffast.h
  88. inffas32.obj: contrib\masmx86\inffas32.asm
  89. match686.obj: contrib\masmx86\match686.asm
  90. example.obj: example.c zlib.h zconf.h
  91. minigzip.obj: minigzip.c zlib.h zconf.h
  92. zlib1.res: win32/zlib1.rc
  93. $(RC) $(RCFLAGS) /fo$@ win32/zlib1.rc
  94. # testing
  95. test: example.exe minigzip.exe
  96. example
  97. echo hello world | minigzip | minigzip -d
  98. testdll: example_d.exe minigzip_d.exe
  99. example_d
  100. echo hello world | minigzip_d | minigzip_d -d
  101. # cleanup
  102. clean:
  103. -del $(STATICLIB)
  104. -del $(SHAREDLIB)
  105. -del $(IMPLIB)
  106. -del *.obj
  107. -del *.res
  108. -del *.exp
  109. -del *.exe
  110. -del *.pdb
  111. -del *.manifest
  112. -del foo.gz