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. 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 (minimal inflate requirements - crc32 is used by libpng)
  23. # zutil can be eliminated if you provide your own zcalloc and zcfree
  24. ZSRCS = adler32$(C) crc32$(C) \
  25. inffast$(C) inflate$(C) inftrees$(C) \
  26. zutil$(C)
  27. # Standard headers
  28. ZH = zlib.h crc32.h inffast.h inffixed.h \
  29. inflate.h inftrees.h zutil.h
  30. # Machine generated headers
  31. ZCONF = zconf.h
  32. # Headers callers use
  33. ZINC = zlib.h $(ZCONF)
  34. # Headers the Zlib source uses
  35. ZHDRS = $(ZH) $(ZCONF)
  36. ZOBJS = adler32$(O) crc32$(O) \
  37. inffast$(O) inflate$(O) inftrees$(O) \
  38. zutil$(O)
  39. # libpng
  40. PNGSRCS=png$(C) pngerror$(C) pngget$(C) pngmem$(C) \
  41. pngread$(C) pngrio$(C) pngrtran$(C) pngrutil$(C) \
  42. pngset$(C) pngtrans$(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. pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) \
  53. pngset$(O) pngtrans$(O)
  54. PROGSRCS= pngm2pnm$(C)
  55. PROGHDRS=
  56. PROGDOCS=
  57. PROGOBJS= pngm2pnm$(O)
  58. OBJS = $(PROGOBJS) $(PNGOBJS) $(ZOBJS)
  59. # implicit make rules -------------------------------------------------------
  60. # note: dependencies do not work on implicit rule lines
  61. .c$(O):
  62. $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
  63. # dependencies
  64. all: pngm2pnm$(E)
  65. pngm2pnm$(E): $(OBJS)
  66. $(LD) -o pngm2pnm$(E) $(OBJS)
  67. # The DFA_XTRA setting turns all libpng options off then
  68. # turns on those required for this minimal build.
  69. # The CPP_FLAGS setting causes pngusr.h to be included in
  70. # both the build of pnglibconf.h and, subsequently, when
  71. # building libpng itself.
  72. $(PNGCONF): $(PNGSRC)/scripts/pnglibconf.mak $(ZH)\
  73. $(PNGSRC)/scripts/pnglibconf.dfa \
  74. $(PNGSRC)/scripts/options.awk pngusr.h pngusr.dfa
  75. $(RM) pnglibconf.h pnglibconf.dfn
  76. $(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
  77. srcdir=$(PNGSRC) CPPFLAGS="-DPNG_USER_CONFIG -I."\
  78. DFA_XTRA="pngusr.dfa" $@
  79. clean:
  80. $(MAKE) -f $(PNGSRC)/scripts/pnglibconf.mak $(MAKEFLAGS)\
  81. srcdir=$(PNGSRC) clean
  82. $(RM) pngm2pnm$(O)
  83. $(RM) pngm2pnm$(E)
  84. $(RM) $(OBJS)
  85. # distclean also removes the copied source and headers
  86. distclean: clean
  87. $(RM) -r scripts # historical reasons
  88. $(RM) $(PNGSRCS) $(PNGH)
  89. $(RM) $(ZSRCS) $(ZH) $(ZCONF)
  90. $(RM) $(PROGSRCS) $(PROGHDRS) $(PROGDOCS)
  91. # Header file dependencies:
  92. $(PROGOBJS): $(PROGHDRS) $(PNGINC) $(ZINC)
  93. $(PNGOBJS): $(PNGHDRS) $(ZINC)
  94. $(ZOBJS): $(ZHDRS)
  95. # Gather the source code from the respective directories
  96. $(PNGSRCS) $(PNGH): $(PNGSRC)/$@
  97. $(RM) $@
  98. $(COPY) $(PNGSRC)/$@ $@
  99. # No dependency on the ZLIBSRC target so that it only needs
  100. # to be specified once.
  101. $(ZSRCS) $(ZH):
  102. $(RM) $@
  103. $(COPY) $(ZLIBSRC)/$@ $@
  104. # The unconfigured zconf.h varies in name according to the
  105. # zlib release
  106. $(ZCONF):
  107. $(RM) $@
  108. @for f in zconf.h.in zconf.in.h zconf.h; do\
  109. test -r $(ZLIBSRC)/$$f &&\
  110. echo $(COPY) $(ZLIBSRC)/$$f $@ &&\
  111. $(COPY) $(ZLIBSRC)/$$f $@ && exit 0;\
  112. done; echo copy: $(ZLIBSRC)/zconf.h not found; exit 1
  113. pngm2pnm.c: $(PROGSRC)/png2pnm.c
  114. $(RM) $@
  115. $(COPY) $(PROGSRC)/png2pnm.c $@
  116. # End of makefile for pngm2pnm