Makefile.sgi 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. # Sample makefile for rpng-x / rpng2-x / wpng for SGI using cc and make.
  2. # Greg Roelofs
  3. # Last modified: 7 March 2002
  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? Buy some for friends
  8. # and family, too. (Not that this is a blatant plug or anything.)
  9. #
  10. # Invoke this makefile from a shell prompt in the usual way; for example:
  11. #
  12. # make -f Makefile.sgi
  13. #
  14. # This makefile assumes libpng and zlib have already been built or downloaded
  15. # and are both installed in /usr/local/{include,lib} (as indicated by the
  16. # PNG* and Z* macros below). Edit as appropriate--choose only ONE each of
  17. # the PNGINC, PNGLIB, ZINC and ZLIB lines.
  18. #
  19. # This makefile builds dynamically linked executables (against libpng and zlib,
  20. # that is), but that can be changed by uncommenting the appropriate PNGLIB and
  21. # ZLIB lines.
  22. # macros --------------------------------------------------------------------
  23. PNGINC = -I/usr/local/include/libpng16
  24. PNGLIB = -L/usr/local/lib -lpng16 # dynamically linked against libpng
  25. #PNGLIB = /usr/local/lib/libpng16.a # statically linked against libpng
  26. # or:
  27. #PNGINC = -I../..
  28. #PNGLIB = -L../.. -lpng
  29. #PNGLIB = ../../libpng.a
  30. ZINC = -I/usr/local/include
  31. ZLIB = -L/usr/local/lib -lz # dynamically linked against zlib
  32. #ZLIB = /usr/local/lib/libz.a # statically linked against zlib
  33. #ZINC = -I../zlib
  34. #ZLIB = -L../zlib -lz
  35. #ZLIB = ../../../zlib/libz.a
  36. XINC = -I/usr/include/X11 # old-style, stock X distributions
  37. XLIB = -L/usr/lib/X11 -lX11
  38. #XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
  39. #XLIB = -L/usr/openwin/lib -lX11
  40. #XINC = -I/usr/X11R6/include # new X distributions (XFree86, etc.)
  41. #XLIB = -L/usr/X11R6/lib -lX11
  42. INCS = $(PNGINC) $(ZINC) $(XINC)
  43. RLIBS = $(PNGLIB) $(ZLIB) $(XLIB) -lm
  44. WLIBS = $(PNGLIB) $(ZLIB)
  45. CC = cc
  46. LD = cc
  47. RM = rm -f
  48. # ABI must be the same as that used to build libpng.
  49. ABI =
  50. CPPFLAGS =
  51. CFLAGS = $(ABI) -O -fullwarn $(INCS)
  52. LDFLAGS = $(ABI)
  53. O = .o
  54. E =
  55. RPNG = rpng-x
  56. RPNG2 = rpng2-x
  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 $(CPPFLAGS) $(CFLAGS) $<
  65. # dependencies --------------------------------------------------------------
  66. all: $(EXES)
  67. $(RPNG)$(E): $(ROBJS)
  68. $(LD) $(LDFLAGS) -o $@ $(ROBJS) $(RLIBS)
  69. $(RPNG2)$(E): $(ROBJS2)
  70. $(LD) $(LDFLAGS) -o $@ $(ROBJS2) $(RLIBS)
  71. $(WPNG)$(E): $(WOBJS)
  72. $(LD) $(LDFLAGS) -o $@ $(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. $(RM) $(EXES) $(ROBJS) $(ROBJS2) $(WOBJS)