Makefile.msc 4.5 KB

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