Makefile.w32 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. # Sample makefile for rpng-win / rpng2-win / wpng using MSVC and NMAKE.
  2. # Greg Roelofs
  3. # Last modified: 2 June 2007
  4. #
  5. # The programs built by this makefile are described in the book,
  6. # "PNG: The Definitive Guide," by Greg Roelofs (O'Reilly and
  7. # Associates, 1999). Go buy a copy, eh? Well, OK, it's not
  8. # generally for sale anymore, but it's the thought that counts,
  9. # right? (Hint: http://www.libpng.org/pub/png/book/ )
  10. #
  11. # Invoke this makefile from a DOS prompt window via:
  12. #
  13. # %devstudio%\vc\bin\vcvars32.bat
  14. # nmake -nologo -f Makefile.w32
  15. #
  16. # where %devstudio% is the installation directory for MSVC / DevStudio. If
  17. # you get "environment out of space" errors, create a desktop shortcut with
  18. # "c:\windows\command.com /e:4096" as the program command line and set the
  19. # working directory to this directory. Then double-click to open the new
  20. # DOS-prompt window with a bigger environment and retry the commands above.
  21. #
  22. # This makefile assumes libpng and zlib have already been built or downloaded
  23. # and are in subdirectories at the same level as the current subdirectory
  24. # (as indicated by the PNGPATH and ZPATH macros below). Edit as appropriate.
  25. #
  26. # Note that the names of the dynamic and static libpng and zlib libraries
  27. # used below may change in later releases of the libraries. This makefile
  28. # builds statically linked executables, but that can be changed by uncom-
  29. # menting the appropriate PNGLIB and ZLIB lines.
  30. !include <ntwin32.mak>
  31. # macros --------------------------------------------------------------------
  32. PNGPATH = ../libpng
  33. PNGINC = -I$(PNGPATH)
  34. #PNGLIB = $(PNGPATH)/pngdll.lib
  35. PNGLIB = $(PNGPATH)/libpng.lib
  36. ZPATH = ../zlib
  37. ZINC = -I$(ZPATH)
  38. #ZLIB = $(ZPATH)/zlibdll.lib
  39. ZLIB = $(ZPATH)/zlibstat.lib
  40. WINLIBS = -defaultlib:user32.lib gdi32.lib
  41. # ["real" apps may also need comctl32.lib, comdlg32.lib, winmm.lib, etc.]
  42. INCS = $(PNGINC) $(ZINC)
  43. RLIBS = $(PNGLIB) $(ZLIB) $(WINLIBS)
  44. WLIBS = $(PNGLIB) $(ZLIB)
  45. CC = cl
  46. LD = link
  47. RM = del
  48. CFLAGS = -nologo -O -W3 $(INCS) $(cvars)
  49. # [note that -W3 is an MSVC-specific compilation flag ("all warnings on")]
  50. # [see %devstudio%\vc\include\win32.mak for cvars macro definition]
  51. O = .obj
  52. E = .exe
  53. RLDFLAGS = -nologo -subsystem:windows
  54. WLDFLAGS = -nologo
  55. RPNG = rpng-win
  56. RPNG2 = rpng2-win
  57. WPNG = wpng
  58. ROBJS = $(RPNG)$(O) readpng$(O)
  59. ROBJS2 = $(RPNG2)$(O) readpng2$(O)
  60. WOBJS = $(WPNG)$(O) writepng$(O)
  61. EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
  62. # implicit make rules -------------------------------------------------------
  63. .c$(O):
  64. $(CC) -c $(CFLAGS) $<
  65. # dependencies --------------------------------------------------------------
  66. all: $(EXES)
  67. $(RPNG)$(E): $(ROBJS)
  68. $(LD) $(RLDFLAGS) -out:$@ $(ROBJS) $(RLIBS)
  69. $(RPNG2)$(E): $(ROBJS2)
  70. $(LD) $(RLDFLAGS) -out:$@ $(ROBJS2) $(RLIBS)
  71. $(WPNG)$(E): $(WOBJS)
  72. $(LD) $(WLDFLAGS) -out:$@ $(WOBJS) $(WLIBS)
  73. $(RPNG)$(O): $(RPNG).c readpng.h
  74. $(RPNG2)$(O): $(RPNG2).c readpng2.h
  75. $(WPNG)$(O): $(WPNG).c writepng.h
  76. readpng$(O): readpng.c readpng.h
  77. readpng2$(O): readpng2.c readpng2.h
  78. writepng$(O): writepng.c writepng.h
  79. # maintenance ---------------------------------------------------------------
  80. clean:
  81. # ideally we could just do this:
  82. # $(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)
  83. # ...but the Windows "DEL" command is none too bright, so:
  84. $(RM) r*$(E)
  85. $(RM) w*$(E)
  86. $(RM) r*$(O)
  87. $(RM) w*$(O)