makefile.aix 2.9 KB
Newer Older
1
# makefile for libpng using gcc (generic, static library)
2
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
3 4
# Copyright (C) 2000 Cosmin Truta
# Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
5
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
6 7 8 9 10 11 12 13 14
# For conditions of distribution and use, see copyright notice in png.h

# Location of the zlib library and include files
ZLIBINC = ../zlib
ZLIBLIB = ../zlib

# Compiler, linker, lib and other tools
CC = gcc
LD = $(CC)
15
AR_RC = ar rcs
16
RANLIB = ranlib
17 18
RM_F = rm -f
LN_SF = ln -f -s
19

20
LIBNAME=libpng12
21
PNGMAJ = 0
22
PNGMIN = 1.2.9beta7
23 24 25 26 27 28
PNGVER = $(PNGMAJ).$(PNGMIN)

prefix=/usr/local
INCPATH=$(prefix)/include
LIBPATH=$(prefix)/lib

29 30 31 32 33 34
# 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
35
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
36 37 38
# you execute make install.
DESTDIR=

39 40
DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH)
41

42 43 44 45
CDEBUG = -g -DPNG_DEBUG=5
LDDEBUG =
CRELEASE = -O2
LDRELEASE = -s
46 47
WARNMORE=-Wall
CFLAGS = -I$(ZLIBINC) $(WARNMORE) $(CRELEASE)
48
LDFLAGS = -L. -L$(ZLIBLIB) -lpng12 -lz -lm $(LDRELEASE)
49 50 51 52 53 54 55 56 57 58 59 60

# File extensions
O=.o
A=.a
E=

# Variables
OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
	pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
	pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)

# Targets
61
all: $(LIBNAME)$(A) pngtest$(E)
62

63
$(LIBNAME)$(A): $(OBJS)
64
	$(AR_RC) $@ $(OBJS)
65 66 67 68 69
	$(RANLIB) $@

test: pngtest$(E)
	./pngtest$(E)

70
pngtest$(E): pngtest$(O) $(LIBNAME)$(A)
71 72
	$(LD) -o $@ pngtest$(O) $(LDFLAGS)

73
install: $(LIBNAME)$(A)
74
	-@if [ ! -d $(DI)  ]; then mkdir $(DI); fi
75
	-@if [ ! -d $(DI)/$(LIBNAME)  ]; then mkdir $(DI)/$(LIBNAME); fi
76
	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
77 78 79 80
	-@$(RM_F) $(DI)/$(LIBNAME)/png.h
	-@$(RM_F) $(DI)/$(LIBNAME)/pngconf.h
	-@$(RM_F) $(DI)/png.h
	-@$(RM_F) $(DI)/pngconf.h
81 82 83
	cp png.h pngconf.h $(DI)/$(LIBNAME)
	chmod 644 $(DI)/$(LIBNAME)/png.h \
	$(DI)/$(LIBNAME)/pngconf.h
84 85 86 87
	-@$(RM_F) -r $(DI)/libpng
	(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
	-@$(RM_F) $(DL)/$(LIBNAME)$(A)
	-@$(RM_F) $(DL)/libpng$(A)
88 89
	cp $(LIBNAME)$(A) $(DL)/$(LIBNAME)$(A)
	chmod 644 $(DL)/$(LIBNAME)$(A)
90 91
	(cd $(DL); $(LN_SF) $(LIBNAME)$(A) libpng$(A))
	(cd $(DI); $(LN_SF) libpng/* .;)
92 93

clean:
94
	$(RM_F) *.o $(LIBNAME)$(A) pngtest pngout.png
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112

png$(O): png.h pngconf.h
pngerror$(O): png.h pngconf.h
pngget$(O): png.h pngconf.h
pngmem$(O): png.h pngconf.h
pngpread$(O): png.h pngconf.h
pngread$(O): png.h pngconf.h
pngrio$(O): png.h pngconf.h
pngrtran$(O): png.h pngconf.h
pngrutil$(O): png.h pngconf.h
pngset$(O): png.h pngconf.h
pngtest$(O): png.h pngconf.h
pngtrans$(O): png.h pngconf.h
pngwio$(O): png.h pngconf.h
pngwrite$(O): png.h pngconf.h
pngwtran$(O): png.h pngconf.h
pngwutil$(O): png.h pngconf.h