makefile.std 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. # makefile for libpng
  2. # Copyright (C) 2002, 2006, 2014 Glenn Randers-Pehrson
  3. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
  4. #
  5. # This code is released under the libpng license.
  6. # For conditions of distribution and use, see the disclaimer
  7. # and license in png.h
  8. # where make install puts libpng.a and png.h
  9. prefix=/usr/local
  10. INCPATH=$(prefix)/include
  11. LIBPATH=$(prefix)/lib
  12. # override DESTDIR= on the make install command line to easily support
  13. # installing into a temporary location. Example:
  14. #
  15. # make install DESTDIR=/tmp/build/libpng
  16. #
  17. # If you're going to install into a temporary location
  18. # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
  19. # you execute make install.
  20. DESTDIR=
  21. # Where the zlib library and include files are located
  22. #ZLIBLIB=/usr/local/lib
  23. #ZLIBINC=/usr/local/include
  24. ZLIBLIB=../zlib
  25. ZLIBINC=../zlib
  26. CC = cc
  27. AR_RC = ar rc
  28. MKDIR_P = mkdir
  29. LN_SF = ln -sf
  30. RANLIB = ranlib
  31. RM_F = rm -f
  32. AWK = awk
  33. SED = sed
  34. CPP = $(CC) -E
  35. ECHO = echo
  36. DFNFLAGS = # DFNFLAGS contains -D options to use in the libpng build
  37. DFA_EXTRA = # extra files that can be used to control configuration
  38. CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
  39. CFLAGS = -O # -g
  40. LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm
  41. OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
  42. pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
  43. pngwtran.o pngmem.o pngerror.o pngpread.o
  44. .c.o:
  45. $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
  46. all: libpng.a pngtest
  47. # The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
  48. # copy this if the following doesn't work.
  49. pnglibconf.h: pnglibconf.dfn
  50. $(RM_F) $@ pnglibconf.c pnglibconf.out pnglibconf.tmp
  51. $(ECHO) '#include "pnglibconf.dfn"' >pnglibconf.c
  52. $(ECHO) "If '$(CC) -E' crashes try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
  53. $(CPP) $(DFNFLAGS) pnglibconf.c >pnglibconf.out
  54. $(AWK) -f "scripts/dfn.awk" out="pnglibconf.tmp" pnglibconf.out 1>&2
  55. mv pnglibconf.tmp $@
  56. pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
  57. $(RM_F) $@ pnglibconf.pre pnglibconf.tmp
  58. $(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2
  59. $(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2
  60. $(AWK) -f scripts/options.awk out="pnglibconf.pre"\
  61. version=search pngconf.h scripts/pnglibconf.dfa\
  62. pngusr.dfa $(DFA_XTRA) 1>&2
  63. $(AWK) -f scripts/options.awk out="pnglibconf.tmp" pnglibconf.pre 1>&2
  64. mv pnglibconf.tmp $@
  65. libpng.a: $(OBJS)
  66. $(AR_RC) $@ $(OBJS)
  67. $(RANLIB) $@
  68. pngtest: pngtest.o libpng.a
  69. $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
  70. test: pngtest
  71. ./pngtest
  72. install: libpng.a pnglibconf.h
  73. -@$(MKDIR_P) $(DESTDIR)$(INCPATH)
  74. -@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
  75. -@$(MKDIR_P) $(DESTDIR)$(LIBPATH)
  76. -@$(RM_F) $(DESTDIR)$(INCPATH)/png.h
  77. -@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h
  78. -@$(RM_F) $(DESTDIR)$(INCPATH)/pnglibconf.h
  79. cp png.h $(DESTDIR)$(INCPATH)/libpng
  80. cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
  81. cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
  82. chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
  83. chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
  84. chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
  85. (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
  86. cp libpng.a $(DESTDIR)$(LIBPATH)
  87. chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
  88. clean:
  89. $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.*
  90. DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
  91. writelock:
  92. chmod a-w *.[ch35] $(DOCS) scripts/*
  93. # DO NOT DELETE THIS LINE -- make depend depends on it.
  94. png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  95. pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  96. pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  97. pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  98. pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  99. pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  100. pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  101. pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  102. pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  103. pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  104. pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  105. pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  106. pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  107. pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  108. pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  109. pngtest.o: png.h pngconf.h pnglibconf.h