makefile.std 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. # makefile for libpng
  2. # Copyright (C) 2002, 2006 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. CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
  38. LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
  39. OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
  40. pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
  41. pngwtran.o pngmem.o pngerror.o pngpread.o
  42. all: libpng.a pngtest
  43. # The standard pnglibconf.h exists as scripts/pnglibconf.h.prebuilt,
  44. # copy this if the following doesn't work.
  45. pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
  46. $(RM_F) $@ dfn?.out
  47. $(AWK) -f scripts/options.awk out=dfn1.out version=search pngconf.h\
  48. scripts/pnglibconf.dfa $(DFA_XTRA) 1>&2
  49. $(AWK) -f scripts/options.awk out=dfn2.out dfn1.out 1>&2
  50. cp dfn2.out $@
  51. $(RM_F) dfn?.out
  52. pnglibconf.h: pnglibconf.dfn
  53. $(RM_F) $@ dfn.c dfn?.out
  54. $(ECHO) '#include "pnglibconf.dfn"' >dfn.c
  55. $(CPP) $(DFNFLAGS) dfn.c >dfn1.out
  56. $(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
  57. dfn1.out >dfn2.out
  58. $(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out
  59. cp dfn3.out $@
  60. $(RM_F) dfn.c dfn?.out
  61. libpng.a: $(OBJS)
  62. $(AR_RC) $@ $(OBJS)
  63. $(RANLIB) $@
  64. pngtest: pngtest.o libpng.a
  65. $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
  66. test: pngtest
  67. ./pngtest
  68. install: libpng.a pnglibconf.h
  69. -@$(MKDIR_P) $(DESTDIR)$(INCPATH)
  70. -@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
  71. -@$(MKDIR_P) $(DESTDIR)$(LIBPATH)
  72. -@$(RM_F) $(DESTDIR)$(INCPATH)/png.h
  73. -@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h
  74. -@$(RM_F) $(DESTDIR)$(INCPATH)/pnglibconf.h
  75. cp png.h $(DESTDIR)$(INCPATH)/libpng
  76. cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
  77. cp pnglibconf.h $(DESTDIR)$(INCPATH)/libpng
  78. chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
  79. chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
  80. chmod 644 $(DESTDIR)$(INCPATH)/libpng/pnglibconf.h
  81. (cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
  82. cp libpng.a $(DESTDIR)$(LIBPATH)
  83. chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
  84. clean:
  85. $(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.* dfn.c dfn?.out
  86. DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
  87. writelock:
  88. chmod a-w *.[ch35] $(DOCS) scripts/*
  89. # DO NOT DELETE THIS LINE -- make depend depends on it.
  90. png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  91. pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  92. pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  93. pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  94. pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  95. pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  96. pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  97. pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  98. pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  99. pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  100. pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  101. pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  102. pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  103. pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  104. pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  105. pngtest.o: png.h pngconf.h pnglibconf.h