blob: 4840c5e1c86b807259bb23afb3ffe1aaae64d680 [file] [log] [blame]
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -05001# makefile for SCO OSr5 ELF and Unixware 7 with Native cc
2# Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx
3# force ELF build dynamic linking, SONAME setting in lib and RPATH in app
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -06004# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
Glenn Randers-Pehrson98c9d732000-05-03 21:06:11 -05005# Copyright (C) 1998 Greg Roelofs
Glenn Randers-Pehrsond4366722000-06-04 14:29:29 -05006# Copyright (C) 1996, 1997 Andreas Dilger
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -05007# For conditions of distribution and use, see copyright notice in png.h
8
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -06009# Library name:
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050010LIBNAME = libpng14
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -050011PNGMAJ = 0
Glenn Randers-Pehrson1916f6a2008-08-14 13:44:49 -050012PNGMIN = 1.4.0beta30
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060013PNGVER = $(PNGMAJ).$(PNGMIN)
14
15# Shared library names:
16LIBSO=$(LIBNAME).so
17LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
18LIBSOVER=$(LIBNAME).so.$(PNGVER)
19OLDSO=libpng.so
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060020
21# Utilities:
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050022CC=cc
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060023AR_RC=ar rc
24MKDIR_P=mkdir
25LN_SF=ln -f -s
26RANLIB=echo
27RM_F=/bin/rm -f
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050028
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060029# where make install puts libpng.a, $(OLDSO)*, and png.h
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060030prefix=/usr/local
Glenn Randers-Pehrsonad310542006-04-18 05:31:20 -050031exec_prefix=$(prefix)
Glenn Randers-Pehrson5c6aeb21998-12-29 11:47:59 -060032
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050033# Where the zlib library and include files are located
34#ZLIBLIB=/usr/local/lib
35#ZLIBINC=/usr/local/include
36ZLIBLIB=../zlib
37ZLIBINC=../zlib
38
Glenn Randers-Pehrsond56aca72000-11-23 11:51:42 -060039CFLAGS= -dy -belf -I$(ZLIBINC) -O3
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050040LDFLAGS=-L. -L$(ZLIBLIB) -lpng14 -lz -lm
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050041
Glenn Randers-Pehrsonfcbd7872002-04-07 16:35:38 -050042INCPATH=$(prefix)/include/libpng
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060043LIBPATH=$(exec_prefix)/lib
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050044MANPATH=$(prefix)/man
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060045BINPATH=$(exec_prefix)/bin
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050046
47# override DESTDIR= on the make install command line to easily support
48# installing into a temporary location. Example:
49#
50# make install DESTDIR=/tmp/build/libpng
51#
52# If you're going to install into a temporary location
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050053# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050054# you execute make install.
55DESTDIR=
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050056
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -050057DB=$(DESTDIR)$(BINPATH)
58DI=$(DESTDIR)$(INCPATH)
59DL=$(DESTDIR)$(LIBPATH)
60DM=$(DESTDIR)$(MANPATH)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -050061
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050062OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
Glenn Randers-Pehrson4393a9a1999-09-17 12:27:26 -050063 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
64 pngwtran.o pngmem.o pngerror.o pngpread.o
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050065
66OBJSDLL = $(OBJS:.o=.pic.o)
67
68.SUFFIXES: .c .o .pic.o
69
70.c.pic.o:
71 $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
72
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -050073all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config pngdefs.h
74
75pngdefs.h:
76 echo "/* pngdefs.h was built by makefile.sco */" > pngdefs.h
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050077
78libpng.a: $(OBJS)
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060079 $(AR_RC) $@ $(OBJS)
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050080 $(RANLIB) $@
81
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -050082libpng.pc:
83 cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
84
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050085libpng-config:
86 ( cat scripts/libpng-config-head.in; \
87 echo prefix=\"$(prefix)\"; \
Glenn Randers-Pehrson5ff38d32002-09-17 23:38:46 -050088 echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
89 echo ccopts=\"-belf\"; \
90 echo L_opts=\"-L$(LIBPATH)\"; \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050091 echo libs=\"-lpng14 -lz -lm\"; \
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -050092 cat scripts/libpng-config-body.in ) > libpng-config
93 chmod +x libpng-config
94
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060095$(LIBSO): $(LIBSOMAJ)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -050096 $(LN_SF) $(LIBSOMAJ) $(LIBSO)
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -050097
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -060098$(LIBSOMAJ): $(LIBSOVER)
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -050099 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ)
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500100
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600101$(LIBSOVER): $(OBJSDLL)
102 $(CC) -G -Wl,-h,$(LIBSOMAJ) -o $(LIBSOVER) \
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500103 $(OBJSDLL)
104
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600105pngtest: pngtest.o $(LIBSO)
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500106 LD_RUN_PATH=.:$(ZLIBLIB) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
107
108test: pngtest
109 ./pngtest
110
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600111install-headers: png.h pngconf.h
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600112 -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
113 -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600114 -@$(RM_F) $(DI)/png.h
115 -@$(RM_F) $(DI)/pngconf.h
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500116 -@$(RM_F) $(DI)/pngdefs.h
117 cp png.h pngconf.h pngdefs.h $(DI)/$(LIBNAME)
Glenn Randers-Pehrson07748d12002-05-25 11:12:10 -0500118 chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500119 chmod 644 $(DI)/$(LIBNAME)/pngdefs.h
120 -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pngdefs.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600121 -@$(RM_F) $(DI)/libpng
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500122 (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600123
124install-static: install-headers libpng.a
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600125 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500126 cp libpng.a $(DL)/$(LIBNAME).a
127 chmod 644 $(DL)/$(LIBNAME).a
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600128 -@$(RM_F) $(DL)/libpng.a
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500129 (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600130
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500131install-shared: install-headers $(LIBSOVER) libpng.pc
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600132 -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600133 -@$(RM_F) $(DL)/$(LIBSOVER)* $(DL)/$(LIBSO)
134 -@$(RM_F) $(DL)/$(LIBSOMAJ)
135 -@$(RM_F) $(DL)/$(OLDSO)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600136 cp $(LIBSOVER) $(DL)
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600137 chmod 755 $(DL)/$(LIBSOVER)
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500138 (cd $(DL); \
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500139 $(LN_SF) $(LIBSOVER) $(LIBSOMAJ); \
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500140 $(LN_SF) $(LIBSOMAJ) $(LIBSO); \
141 $(LN_SF) $(OLDSO) $(LIBSO))
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600142 -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600143 -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
144 -@$(RM_F) $(DL)/pkgconfig/libpng.pc
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500145 cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
146 chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500147 (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
Glenn Randers-Pehrsonc1bfe682002-03-06 22:08:00 -0600148
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500149install-man: libpng.3 libpngpf.3 png.5
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600150 -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
151 -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600152 -@$(RM_F) $(DM)/man3/libpng.3
153 -@$(RM_F) $(DM)/man3/libpngpf.3
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500154 cp libpng.3 $(DM)/man3
155 cp libpngpf.3 $(DM)/man3
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600156 -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600157 -@$(RM_F) $(DM)/man5/png.5
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500158 cp png.5 $(DM)/man5
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500159
Glenn Randers-Pehrson837a3d12002-05-10 20:19:58 -0500160install-config: libpng-config
Glenn Randers-Pehrson1ce08362006-03-08 23:35:59 -0600161 -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600162 -@$(RM_F) $(DB)/libpng-config
163 -@$(RM_F) $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsoncfbed9b2002-05-21 18:06:08 -0500164 cp libpng-config $(DB)/$(LIBNAME)-config
165 chmod 755 $(DB)/$(LIBNAME)-config
Glenn Randers-Pehrsonf628ee22006-04-19 05:00:04 -0500166 (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
Glenn Randers-Pehrson704228f2002-05-02 20:49:40 -0500167
168install: install-static install-shared install-man install-config
Glenn Randers-Pehrson03008a02002-04-27 10:11:25 -0500169
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500170# If you installed in $(DESTDIR), test-installed won't work until you
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500171# move the library to its final location. Use test-dd to test it
172# before then.
173
174test-dd:
175 echo
176 echo Testing installed dynamic shared library in $(DL).
177 $(CC) -I$(DI) $(CFLAGS) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600178 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500179 -L$(DL) -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600180 -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrsona4981d42004-08-25 22:00:45 -0500181 ./pngtestd pngtest.png
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500182
183test-installed:
184 $(CC) $(CFLAGS) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600185 `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500186 -L$(ZLIBLIB) \
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600187 -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
Glenn Randers-Pehrson2ae022d2002-07-01 22:23:46 -0500188 ./pngtesti pngtest.png
189
190clean:
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600191 $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
Glenn Randers-Pehrson4deeb792006-03-22 16:21:59 -0600192 $(LIBSO) $(LIBSOMAJ)* pngtest-static pngtesti \
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500193 libpng.pc pngdefs.h
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500194
Glenn Randers-Pehrson166c5a31999-12-10 09:43:02 -0600195DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
196writelock:
197 chmod a-w *.[ch35] $(DOCS) scripts/*
198
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500199# DO NOT DELETE THIS LINE -- make depend depends on it.
200
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500201png.o png.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
202pngerror.o pngerror.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
203pngrio.o pngrio.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
204pngwio.o pngwio.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
205pngmem.o pngmem.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
206pngset.o pngset.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
207pngget.o pngget.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
208pngread.o pngread.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
209pngrtran.o pngrtran.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
210pngrutil.o pngrutil.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
211pngtrans.o pngtrans.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
212pngwrite.o pngwrite.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
213pngwtran.o pngwtran.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
214pngwutil.o pngwutil.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
215pngpread.o pngpread.pic.o: png.h pngconf.h pngdefs.h pngpriv.h
Glenn Randers-Pehrson1d963611998-05-02 12:52:25 -0500216
Glenn Randers-Pehrsonbeb572e2006-08-19 13:59:24 -0500217pngtest.o: png.h pngconf.h pngdefs.h