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

6 7
# where make install puts libpng.a and png.h
prefix=/usr/local
8 9 10 11 12 13 14 15 16
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
17
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
18 19
# you execute make install.
DESTDIR=
20

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

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

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

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

all: libpng.a pngtest

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

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

test: pngtest
	./pngtest
G
Guy Schalnat 已提交
52 53

install: libpng.a
54 55 56 57 58
	-@$(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
59 60 61 62 63 64 65
	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 已提交
66 67

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

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

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

76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
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