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