makefile.std 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. CP = cp
  32. RM_F = rm -f
  33. AWK = awk
  34. SED = sed
  35. CPP = $(CC) -E
  36. ECHO = echo
  37. DFNFLAGS = # DFNFLAGS contains -D options to use in the libpng build
  38. DFA_EXTRA = # extra files that can be used to control configuration
  39. CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
  40. CFLAGS = -O # -g
  41. LDFLAGS = -L. -L$(ZLIBLIB) -lpng -lz -lm
  42. # Pre-built configuration
  43. # See scripts/pnglibconf.mak for more options
  44. PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
  45. OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
  46. pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
  47. pngwtran.o pngmem.o pngerror.o pngpread.o
  48. .c.o:
  49. $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
  50. all: libpng.a pngtest
  51. # The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
  52. # copy this if the following doesn't work.
  53. pnglibconf.h: pnglibconf.dfn
  54. $(RM_F) $@ pnglibconf.c pnglibconf.out pnglibconf.tmp
  55. $(ECHO) '#include "pnglibconf.dfn"' >pnglibconf.c
  56. $(ECHO) "If '$(CC) -E' crashes try /lib/cpp (e.g. CPP='/lib/cpp')" >&2
  57. $(CPP) $(DFNFLAGS) pnglibconf.c >pnglibconf.out
  58. $(AWK) -f "scripts/dfn.awk" out="pnglibconf.tmp" pnglibconf.out 1>&2
  59. mv pnglibconf.tmp $@
  60. pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
  61. $(RM_F) $@ pnglibconf.pre pnglibconf.tmp
  62. $(ECHO) "Calling $(AWK) from scripts/pnglibconf.mak" >&2
  63. $(ECHO) "If 'awk' crashes try a better awk (e.g. AWK='nawk')" >&2
  64. $(AWK) -f scripts/options.awk out="pnglibconf.pre"\
  65. version=search pngconf.h scripts/pnglibconf.dfa\
  66. pngusr.dfa $(DFA_XTRA) 1>&2
  67. $(AWK) -f scripts/options.awk out="pnglibconf.tmp" pnglibconf.pre 1>&2
  68. mv pnglibconf.tmp $@
  69. libpng.a: $(OBJS)
  70. $(AR_RC) $@ $(OBJS)
  71. $(RANLIB) $@
  72. pngtest: pngtest.o libpng.a
  73. $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
  74. test: pngtest
  75. ./pngtest
  76. install: libpng.a pnglibconf.h
  77. -@$(MKDIR_P) $(DESTDIR)$(INCPATH)
  78. -@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
  79. -@$(MKDIR_P) $(DESTDIR)$(LIBPATH)
  80. -@$(RM_F) $(DESTDIR)$(INCPATH)/png.h
  81. -@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h
  82. -@$(RM_F) $(DESTDIR)$(INCPATH)/pnglibconf.h
  83. cp png.h $(DESTDIR)$(INCPATH)/libpng
  84. cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
  85. cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
  86. chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
  87. chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
  88. chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
  89. (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
  90. cp libpng.a $(DESTDIR)$(LIBPATH)
  91. chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
  92. clean:
  93. $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h pnglibconf.c \
  94. pnglibconf.out
  95. DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
  96. writelock:
  97. chmod a-w *.[ch35] $(DOCS) scripts/*
  98. # DO NOT DELETE THIS LINE -- make depend depends on it.
  99. png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  100. pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  101. pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  102. pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  103. pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  104. pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  105. pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  106. pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  107. pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  108. pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  109. pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  110. pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  111. pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  112. pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  113. pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  114. pngtest.o: png.h pngconf.h pnglibconf.h