makefile.sco 5.6 KB
Newer Older
1 2 3
# makefile for SCO OSr5  ELF and Unixware 7 with Native cc
# Contributed by Mike Hopkirk (hops@sco.com) modified from Makefile.lnx
#   force ELF build dynamic linking, SONAME setting in lib and RPATH in app
4
# Copyright (C) 2002 Glenn Randers-Pehrson
5
# Copyright (C) 1998 Greg Roelofs
6
# Copyright (C) 1996, 1997 Andreas Dilger
7 8 9 10
# For conditions of distribution and use, see copyright notice in png.h

CC=cc

11 12 13
# where make install puts libpng.a, libpng.so*, and png.h
prefix=/usr/local

14 15 16 17 18 19
# Where the zlib library and include files are located
#ZLIBLIB=/usr/local/lib
#ZLIBINC=/usr/local/include
ZLIBLIB=../zlib
ZLIBINC=../zlib

20
CFLAGS= -dy -belf -I$(ZLIBINC) -O3
21
LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm
22 23 24 25

#RANLIB=ranlib
RANLIB=echo

26
PNGMAJ = 0
27
PNGMIN = 1.2.3
28
PNGVER = $(PNGMAJ).$(PNGMIN)
29
LIBNAME = libpng12
30

31
INCPATH=$(prefix)/include/libpng
32
LIBPATH=$(prefix)/lib
33
MANPATH=$(prefix)/man
34
BINPATH=$(prefix)/bin
35 36 37 38 39 40 41 42 43 44

# 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
# via DESTDIR, that location must already exist before
# you execute make install.
DESTDIR=
45

46 47 48 49 50
DB=$(DESTDIR)/$(BINPATH)
DI=$(DESTDIR)/$(INCPATH)
DL=$(DESTDIR)/$(LIBPATH)
DM=$(DESTDIR)/$(MANPATH)

51
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
52 53
	pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
	pngwtran.o pngmem.o pngerror.o pngpread.o
54 55 56 57 58 59 60 61

OBJSDLL = $(OBJS:.o=.pic.o)

.SUFFIXES:      .c .o .pic.o

.c.pic.o:
	$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c

62
all: libpng.a $(LIBNAME).so pngtest
63 64 65 66 67

libpng.a: $(OBJS)
	ar rc $@ $(OBJS)
	$(RANLIB) $@

68 69 70
libpng.pc:
	cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc

71 72 73
libpng-config:
	( cat scripts/libpng-config-head.in; \
	echo prefix=\"$(prefix)\"; \
74
	echo cppflags=\"-I$(INCPATH)/$(LIBNAME)\"; \
75 76 77 78 79 80
	echo cflags=\"-belf\"; \
	echo ldflags=\"-L$(LIBPATH)\"; \
	echo libs=\"-lpng12 -lz -lm\"; \
	cat scripts/libpng-config-body.in ) > libpng-config
	chmod +x libpng-config

81 82
$(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
83

84 85
$(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
86

87 88
$(LIBNAME).so.$(PNGVER): $(OBJSDLL)
	$(CC) -G  -Wl,-h,$(LIBNAME).so.$(PNGMAJ) -o $(LIBNAME).so.$(PNGVER) \
89 90
	 $(OBJSDLL)

91
pngtest: pngtest.o $(LIBNAME).so
92 93 94 95 96
	LD_RUN_PATH=.:$(ZLIBLIB) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)

test: pngtest
	./pngtest

97

98
install-headers: png.h pngconf.h
99 100 101 102 103 104 105 106 107 108
	-@if [ ! -d $(DI) ]; then mkdir $(DI); fi
	-@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
	-@/bin/rm -f $(DI)/png.h
	-@/bin/rm -f $(DI)/pngconf.h
	cp png.h pngconf.h $(DI)/$(LIBNAME)
	chmod 644 $(DI)/$(LIBNAME)/png.h \
	$(DI)/$(LIBNAME)/pngconf.h
	-@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
	-@/bin/rm -f $(DI)/libpng
	(cd $(DI); ln -f -s $(LIBNAME) libpng; \
109
	ln -f -s $(LIBNAME)/* .)
110 111

install-static: install-headers libpng.a
112 113 114 115 116
	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
	cp libpng.a $(DL)/$(LIBNAME).a
	chmod 644 $(DL)/$(LIBNAME).a
	-@/bin/rm -f $(DL)/libpng.a
	(cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
117

118
install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc
119 120 121 122 123 124 125 126 127
	-@if [ ! -d $(DL) ]; then mkdir $(DL); fi
	-@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGMAJ)* \
	$(DL)/$(LIBNAME).so
	-@/bin/rm -f $(DL)/libpng.so
	-@/bin/rm -f $(DL)/libpng.so.3
	-@/bin/rm -f $(DL)/libpng.so.3.*
	cp $(LIBNAME).so.$(PNGVER) $(DL)
	chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
	(cd $(DL); \
128 129 130
	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so; \
	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3; \
	ln -f -s $(LIBNAME).so.$(PNGVER) libpng.so.3.$(PNGMIN); \
131 132
	ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
	ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
133 134 135 136 137 138
	-@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
	-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
	-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
	cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
	chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
	(cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
139 140

install-man: libpng.3 libpngpf.3 png.5
141 142 143 144 145 146 147 148 149
	-@if [ ! -d $(DM) ]; then mkdir $(DM); fi
	-@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
	-@/bin/rm -f $(DM)/man3/libpng.3
	-@/bin/rm -f $(DM)/man3/libpngpf.3
	cp libpng.3 $(DM)/man3
	cp libpngpf.3 $(DM)/man3
	-@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
	-@/bin/rm -f $(DM)/man5/png.5
	cp png.5 $(DM)/man5
150

151
install-config: libpng-config
152 153 154 155 156 157
	-@if [ ! -d $(DB) ]; then mkdir $(DB); fi
	-@/bin/rm -f $(DB)/libpng-config
	-@/bin/rm -f $(DB)/$(LIBNAME)-config
	cp libpng-config $(DB)/$(LIBNAME)-config
	chmod 755 $(DB)/$(LIBNAME)-config
	(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
158 159

install: install-static install-shared install-man install-config
160

161 162

clean:
163
	/bin/rm -f *.o libpng.a $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest pngout.png
164

165 166 167 168
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
	chmod a-w *.[ch35] $(DOCS) scripts/*

169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
# DO NOT DELETE THIS LINE -- make depend depends on it.

png.o png.pic.o: png.h pngconf.h
pngerror.o pngerror.pic.o: png.h pngconf.h
pngrio.o pngrio.pic.o: png.h pngconf.h
pngwio.o pngwio.pic.o: png.h pngconf.h
pngmem.o pngmem.pic.o: png.h pngconf.h
pngset.o pngset.pic.o: png.h pngconf.h
pngget.o pngget.pic.o: png.h pngconf.h
pngread.o pngread.pic.o: png.h pngconf.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h
pngpread.o pngpread.pic.o: png.h pngconf.h

pngtest.o: png.h pngconf.h