makefile 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. # Makefile for PngMinus (rpng2)
  2. # Linux / Unix
  3. #CC=cc
  4. CC=gcc
  5. LD=$(CC)
  6. # If awk fails try
  7. # make AWK=nawk
  8. # If cpp fails try
  9. # make CPP=/lib/cpp
  10. RM=rm -f
  11. COPY=cp
  12. #XINC = -I/usr/include # old-style, stock X distributions
  13. #XLIB = -L/usr/lib/X11 -lX11 # (including SGI IRIX)
  14. #XINC = -I/usr/openwin/include # Sun workstations (OpenWindows)
  15. #XLIB = -L/usr/openwin/lib -lX11
  16. XINC = -I/usr/X11R6/include # new X distributions (X.org, etc.)
  17. XLIB = -L/usr/X11R6/lib -lX11
  18. #XLIB = -L/usr/X11R6/lib64 -lX11 # e.g., Red Hat on AMD64
  19. #XINC = -I/usr/local/include # FreeBSD
  20. #XLIB = -L/usr/local/lib -lX11
  21. #LIBS = $(XLIB)
  22. LIBS = $(XLIB) -lm #platforms that need libm
  23. CPPFLAGS=-I. $(XINC) -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DZ_SOLO -DNO_GZIP
  24. CFLAGS=-O1 -Wall
  25. C=.c
  26. O=.o
  27. L=.a
  28. E=
  29. # Where to find the source code:
  30. PNGSRC =../../..
  31. ZLIBSRC=$(PNGSRC)/../zlib
  32. PROGSRC=$(PNGSRC)/contrib/gregbook
  33. # Zlib (minimal inflate requirements - crc32 is used by libpng)
  34. # zutil can be eliminated if you provide your own zcalloc and zcfree
  35. ZSRCS = adler32$(C) crc32$(C) \
  36. inffast$(C) inflate$(C) inftrees$(C) \
  37. zutil$(C)
  38. # Standard headers
  39. ZH = zlib.h crc32.h inffast.h inffixed.h \
  40. inflate.h inftrees.h zutil.h
  41. # Machine generated headers
  42. ZCONF = zconf.h
  43. # Headers callers use
  44. ZINC = zlib.h $(ZCONF)
  45. # Headers the Zlib source uses
  46. ZHDRS = $(ZH) $(ZCONF)
  47. ZOBJS = adler32$(O) crc32$(O) \
  48. inffast$(O) inflate$(O) inftrees$(O) \
  49. zutil$(O)
  50. # libpng
  51. PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
  52. pngpread$(C) pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
  53. pngset$(C) pngtrans$(C)
  54. # Standard headers
  55. PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
  56. # Machine generated headers
  57. PNGCONF=pnglibconf.h
  58. # Headers callers use
  59. PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
  60. # Headers the PNG library uses
  61. PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
  62. PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
  63. pngpread$(O) pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
  64. pngset$(O) pngtrans$(O)
  65. PROGSRCS= rpng2-x$(C) readpng2$(C)
  66. PROGHDRS= readpng2.h
  67. PROGDOCS= COPYING LICENSE
  68. PROGOBJS= rpng2-x$(O) readpng2$(O)
  69. OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
  70. # implicit make rules -------------------------------------------------------
  71. .c$(O):
  72. $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
  73. # dependencies
  74. all: $(PROGDOCS) rpng2-x$(E)
  75. rpng2-x$(E): $(OBJS)
  76. $(LD) -o rpng2-x$(E) $(OBJS) $(LIBS)
  77. # The DFA_XTRA setting turns all libpng options off then
  78. # turns on those required for this minimal build.
  79. # The CPP_FLAGS setting causes pngusr.h to be included in
  80. # both the build of pnglibconf.h and, subsequently, when
  81. # building libpng itself.
  82. $(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\
  83. $(PNGSRC)/scripts/pnglibconf.dfa \
  84. $(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
  85. $(RM) pnglibconf.h pnglibconf.dfn
  86. $(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
  87. srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\
  88. DFA_XTRA="pngusr.dfa" $@
  89. clean:
  90. $(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
  91. srcdir=$(PNGSRC) clean
  92. $(RM) rpng2-x$(O)
  93. $(RM) rpng2-x$(E)
  94. $(RM) $(OBJS)
  95. # distclean also removes the copied source and headers
  96. distclean: clean
  97. $(RM) -r scripts # historical reasons
  98. $(RM) $(PNGSRCS) $(PNGH)
  99. $(RM) $(ZSRCS) $(ZH) $(ZCONF)
  100. $(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
  101. # Header file dependencies:
  102. $(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
  103. $(PNGOBJS): $(PNGHDRS) $(ZINC)
  104. $(ZOBJS): $(ZHDRS)
  105. # Gather the source code from the respective directories
  106. $(PNGSRCS) $(PNGH): $(PNGSRC)/$@
  107. $(RM) $@
  108. $(COPY) $(PNGSRC)/$@ $@
  109. # No dependency on the ZLIBSRC target so that it only needs
  110. # to be specified once.
  111. $(ZSRCS) $(ZH):
  112. $(RM) $@
  113. $(COPY) $(ZLIBSRC)/$@ $@
  114. # The unconfigured zconf.h varies in name according to the
  115. # zlib release
  116. $(ZCONF):
  117. $(RM) $@
  118. @for f in zconf.h.in zconf.in.h zconf.h; do\
  119. test -r $(ZLIBSRC)/$$f &&\
  120. echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
  121. $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
  122. done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
  123. $(PROGSRCS) $(PROGHDRS) $(PROGDOCS): $(PROGSRC)/$@
  124. $(RM) $@
  125. $(COPY) $(PROGSRC)/$@ $@
  126. # End of makefile for rpng2-x