makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. # Makefile for PngMinus (pnm2pngm)
  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. CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
  13. C=.c
  14. O=.o
  15. L=.a
  16. E=
  17. # Where to find the source code:
  18. PNGSRC =../../..
  19. ZLIBSRC=$(PNGSRC)/../zlib
  20. PROGSRC=$(PNGSRC)/contrib/pngminus
  21. # Zlib
  22. ZSRCS = adler32$(C) compress$(C) crc32$(C) deflate$(C) \
  23. trees$(C) zutil$(C)
  24. # Standard headers
  25. #ZH = zlib.h crc32.h deflate.h trees.h zutil.h
  26. ZH = zlib.h crc32.h deflate.h trees.h zutil.h
  27. # Machine generated headers
  28. ZCONF = zconf.h
  29. # Headers callers use
  30. ZINC = zlib.h $(ZCONF)
  31. # Headers the Zlib source uses
  32. ZHDRS = $(ZH) $(ZCONF)
  33. # compress is not required; it is needed to link the zlib
  34. # code because deflate defines an unused API function deflateBound
  35. # which itself calls compressBound from compress.
  36. ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \
  37. trees$(O) zutil$(O)
  38. # libpng
  39. PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
  40. pngset$(C) pngtrans$(C) pngwio$(C) pngwrite$(C) \
  41. pngwtran$(C) pngwutil$(C)
  42. # Standard headers
  43. PNGH =png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
  44. # Machine generated headers
  45. PNGCONF=pnglibconf.h
  46. # Headers callers use
  47. PNGINC= png.h pngconf.h pngusr.h $(PNGCONF)
  48. # Headers the PNG library uses
  49. PNGHDRS=$(PNGH) $(PNGCONF) pngusr.h
  50. PNGOBJS=png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
  51. pngset$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) \
  52. pngwtran$(O) pngwutil$(O)
  53. PROGSRCS= pnm2pngm$(C)
  54. PROGHDRS=
  55. PROGDOCS=
  56. PROGOBJS= pnm2pngm$(O)
  57. OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
  58. # implicit make rules -------------------------------------------------------
  59. .c$(O):
  60. $(CC) -c $(CFLAGS) $<
  61. # dependencies
  62. all: pnm2pngm$(E)
  63. pnm2pngm$(E): $(OBJS)
  64. $(LD) -o pnm2pngm$(E) $(OBJS)
  65. # The DFA_XTRA setting turns all libpng options off then
  66. # turns on those required for this minimal build.
  67. # The CPP_FLAGS setting causes pngusr.h to be included in
  68. # both the build of pnglibconf.h and, subsequently, when
  69. # building libpng itself.
  70. $(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak\
  71. $(PNGSRC)/scripts/pnglibconf.dfa \
  72. $(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
  73. $(RM) pnglibconf.h pnglibconf.dfn
  74. $(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
  75. srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
  76. DFA_XTRA="pngusr.dfa" $@
  77. clean:
  78. $(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
  79. srcdir=$(PNGSRC) clean
  80. $(RM) pnm2pngm$(O)
  81. $(RM) pnm2pngm$(E)
  82. $(RM) $(OBJS)
  83. # distclean also removes the copied source and headers
  84. distclean: clean
  85. $(RM) -r scripts # historical reasons
  86. $(RM) $(PNGSRCS) $(PNGH)
  87. $(RM) $(ZSRCS) $(ZH) $(ZCONF)
  88. $(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
  89. # Header file dependencies:
  90. $(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
  91. $(PNGOBJS): $(PNGHDRS) $(ZINC)
  92. $(ZOBJS): $(ZHDRS)
  93. # Gather the source code from the respective directories
  94. $(PNGSRCS) $(PNGH): $(PNGSRC)/$@
  95. $(RM) $@
  96. $(COPY) $(PNGSRC)/$@ $@
  97. # No dependency on the ZLIBSRC target so that it only needs
  98. # to be specified once.
  99. $(ZSRCS) $(ZH):
  100. $(RM) $@
  101. $(COPY) $(ZLIBSRC)/$@ $@
  102. # The unconfigured zconf.h varies in name according to the
  103. # zlib release
  104. $(ZCONF):
  105. $(RM) $@
  106. @for f in zconf.h.in zconf.in.h zconf.h; do\
  107. test -r $(ZLIBSRC)/$$f &&\
  108. echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
  109. $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
  110. done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
  111. pnm2pngm.c: $(PROGSRC)/pnm2png.c
  112. $(RM) $@
  113. $(COPY) $(PROGSRC)/pnm2png.c $@
  114. # End of makefile for pnm2pngm