Makefile.msc 4.8 KB

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