makefile.std 2.6 KB
Newer Older
G
Guy Schalnat 已提交
1
# makefile for libpng
2
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
G
Guy Schalnat 已提交
3
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
4 5
#
# This code is released under the zlib-libpng license.
G
Guy Schalnat 已提交
6 7
# For conditions of distribution and use, see copyright notice in png.h

8 9
# where make install puts libpng.a and png.h
prefix=/usr/local
10 11 12 13 14 15 16 17 18
INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib

# override DESTDIR= on the make install command line to easily support
# installing into a temporary location.  Example:
#
#    make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
19
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
20 21
# you execute make install.
DESTDIR=
22

A
Andreas Dilger 已提交
23 24 25 26 27 28
# Where the zlib library and include files are located
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib

G
Guy Schalnat 已提交
29
CC=cc
30 31 32 33 34 35
AR_RC=ar rc
MKDIR_P=mkdir
LN_SF=ln -sf
RANLIB=ranlib
RM_F=rm -f

36 37 38
CFLAGS=-I$(ZLIBINC) -O # -g -DPNG_DEBUG=5
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm

A
Andreas Dilger 已提交
39
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
G
Guy Schalnat 已提交
40 41
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o
G
Guy Schalnat 已提交
42 43 44 45

all: libpng.a pngtest

libpng.a: $(OBJS)
46
	$(AR_RC) $@  $(OBJS)
G
Guy Schalnat 已提交
47 48 49
	$(RANLIB) $@

pngtest: pngtest.o libpng.a
50
	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
G
Guy Schalnat 已提交
51 52 53

test: pngtest
	./pngtest
G
Guy Schalnat 已提交
54 55

install: libpng.a
56 57 58 59 60
	-@$(MKDIR_P) $(DESTDIR)$(INCPATH)
	-@$(MKDIR_P) $(DESTDIR)$(INCPATH)/libpng
	-@$(MKDIR_P) $(DESTDIR)$(LIBPATH)
	-@$(RM_F) $(DESTDIR)$(INCPATH)/png.h
	-@$(RM_F) $(DESTDIR)$(INCPATH)/pngconf.h
61 62 63 64 65 66 67
	cp png.h $(DESTDIR)$(INCPATH)/libpng
	cp pngconf.h $(DESTDIR)$(INCPATH)/libpng
	chmod 644 $(DESTDIR)$(INCPATH)/libpng/png.h
	chmod 644 $(DESTDIR)$(INCPATH)/libpng/pngconf.h
	(cd $(DESTDIR)$(INCPATH); ln -f -s libpng/* .)
	cp libpng.a $(DESTDIR)$(LIBPATH)
	chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
G
Guy Schalnat 已提交
68 69

clean:
70
	$(RM_F) *.o libpng.a pngtest pngout.png
G
Guy Schalnat 已提交
71

72 73 74 75
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*

G
Guy Schalnat 已提交
76 77
# DO NOT DELETE THIS LINE -- make depend depends on it.

78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
png.o: png.h pngconf.h pngpriv.h
pngerror.o: png.h pngconf.h pngpriv.h
pngrio.o: png.h pngconf.h pngpriv.h
pngwio.o: png.h pngconf.h pngpriv.h
pngmem.o: png.h pngconf.h pngpriv.h
pngset.o: png.h pngconf.h pngpriv.h
pngget.o: png.h pngconf.h pngpriv.h
pngread.o: png.h pngconf.h pngpriv.h
pngrtran.o: png.h pngconf.h pngpriv.h
pngrutil.o: png.h pngconf.h pngpriv.h
pngtrans.o: png.h pngconf.h pngpriv.h
pngwrite.o: png.h pngconf.h pngpriv.h
pngwtran.o: png.h pngconf.h pngpriv.h
pngwutil.o: png.h pngconf.h pngpriv.h
pngpread.o: png.h pngconf.h pngpriv.h

pngtest.o: png.h pngconf.h