makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. # Makefile for PngMinus (pngm2pnm)
  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_GZCOMPRESS -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 (minimal inflate requirements - crc32 is used by libpng)
  22. # zutil can be eliminated if you provide your own zcalloc and zcfree
  23. ZSRCS = adler32$(C) crc32$(C) \
  24. inffast$(C) inflate$(C) inftrees$(C) \
  25. zutil$(C)
  26. # Standard headers
  27. ZH = zlib.h crc32.h inffast.h inffixed.h \
  28. inflate.h inftrees.h zutil.h
  29. # Machine generated headers
  30. ZCONF = zconf.h
  31. # Headers callers use
  32. ZINC = zlib.h $(ZCONF)
  33. # Headers the Zlib source uses
  34. ZHDRS = $(ZH) $(ZCONF)
  35. ZOBJS = adler32$(O) crc32$(O) \
  36. inffast$(O) inflate$(O) inftrees$(O) \
  37. zutil$(O)
  38. # libpng
  39. PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
  40. pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
  41. pngset$(C) pngtrans$(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. pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
  52. pngset$(O) pngtrans$(O)
  53. PROGSRCS= pngm2pnm$(C)
  54. PROGHDRS=
  55. PROGDOCS=
  56. PROGOBJS= pngm2pnm$(O)
  57. OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
  58. # implicit make rules -------------------------------------------------------
  59. # note: dependencies do not work on implicit rule lines
  60. .c$(O):
  61. $(CC) -c $(CFLAGS) $<
  62. # dependencies
  63. all: pngm2pnm$(E)
  64. pngm2pnm$(E): $(OBJS)
  65. $(LD) -o pngm2pnm$(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\
  72. $(PNGSRC)/scripts/pnglibconf.dfa \
  73. $(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
  74. $(RM) pnglibconf.h pnglibconf.dfn
  75. $(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
  76. srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG"\
  77. DFA_XTRA="pngusr.dfa" $@
  78. clean:
  79. $(MAKE) $(MAKEFLAGS) -f $(PNGSRC)/scripts/pnglibconf.mak\
  80. srcdir=$(PNGSRC) clean
  81. $(RM) pngm2pnm$(O)
  82. $(RM) pngm2pnm$(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. pngm2pnm.c: $(PROGSRC)/png2pnm.c
  113. $(RM) $@
  114. $(COPY) $(PROGSRC)/png2pnm.c $@
  115. # End of makefile for pngm2pnm