Makefile.w32 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. CPPFLAGS = $(INCS)
  49. CFLAGS = -nologo -O -W3 $(cvars)
  50. # [note that -W3 is an MSVC-specific compilation flag ("all warnings on")]
  51. # [see %devstudio%\vc\include\win32.mak for cvars macro definition]
  52. O = .obj
  53. E = .exe
  54. RLDFLAGS = -nologo -subsystem:windows
  55. WLDFLAGS = -nologo
  56. RPNG = rpng-win
  57. RPNG2 = rpng2-win
  58. WPNG = wpng
  59. ROBJS = $(RPNG)$(O) readpng$(O)
  60. ROBJS2 = $(RPNG2)$(O) readpng2$(O)
  61. WOBJS = $(WPNG)$(O) writepng$(O)
  62. EXES = $(RPNG)$(E) $(RPNG2)$(E) $(WPNG)$(E)
  63. # implicit make rules -------------------------------------------------------
  64. .c$(O):
  65. $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
  66. # dependencies --------------------------------------------------------------
  67. all: $(EXES)
  68. $(RPNG)$(E): $(ROBJS)
  69. $(LD) $(RLDFLAGS) -out:$@ $(ROBJS) $(RLIBS)
  70. $(RPNG2)$(E): $(ROBJS2)
  71. $(LD) $(RLDFLAGS) -out:$@ $(ROBJS2) $(RLIBS)
  72. $(WPNG)$(E): $(WOBJS)
  73. $(LD) $(WLDFLAGS) -out:$@ $(WOBJS) $(WLIBS)
  74. $(RPNG)$(O): $(RPNG).c readpng.h
  75. $(RPNG2)$(O): $(RPNG2).c readpng2.h
  76. $(WPNG)$(O): $(WPNG).c writepng.h
  77. readpng$(O): readpng.c readpng.h
  78. readpng2$(O): readpng2.c readpng2.h
  79. writepng$(O): writepng.c writepng.h
  80. # maintenance ---------------------------------------------------------------
  81. clean:
  82. # ideally we could just do this:
  83. # $(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)
  84. # ...but the Windows "DEL" command is none too bright, so:
  85. $(RM) r*$(E)
  86. $(RM) w*$(E)
  87. $(RM) r*$(O)
  88. $(RM) w*$(O)