| 1 | # 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
|
|---|
| 4 | # Copyright (C) 2002 Glenn Randers-Pehrson
|
|---|
| 5 | # Copyright (C) 1998 Greg Roelofs
|
|---|
| 6 | # Copyright (C) 1996, 1997 Andreas Dilger
|
|---|
| 7 | # For conditions of distribution and use, see copyright notice in png.h
|
|---|
| 8 |
|
|---|
| 9 | CC=cc
|
|---|
| 10 |
|
|---|
| 11 | # where make install puts libpng.a, libpng.so*, and png.h
|
|---|
| 12 | prefix=/usr/local
|
|---|
| 13 |
|
|---|
| 14 | # Where the zlib library and include files are located
|
|---|
| 15 | #ZLIBLIB=/usr/local/lib
|
|---|
| 16 | #ZLIBINC=/usr/local/include
|
|---|
| 17 | ZLIBLIB=../zlib
|
|---|
| 18 | ZLIBINC=../zlib
|
|---|
| 19 |
|
|---|
| 20 | CFLAGS= -dy -belf -I$(ZLIBINC) -O3
|
|---|
| 21 | LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm
|
|---|
| 22 |
|
|---|
| 23 | #RANLIB=ranlib
|
|---|
| 24 | RANLIB=echo
|
|---|
| 25 |
|
|---|
| 26 | PNGMAJ = 0
|
|---|
| 27 | PNGMIN = 1.2.5
|
|---|
| 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 | # override DESTDIR= on the make install command line to easily support
|
|---|
| 37 | # installing into a temporary location. Example:
|
|---|
| 38 | #
|
|---|
| 39 | # make install DESTDIR=/tmp/build/libpng
|
|---|
| 40 | #
|
|---|
| 41 | # If you're going to install into a temporary location
|
|---|
| 42 | # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
|
|---|
| 43 | # you execute make install.
|
|---|
| 44 | DESTDIR=
|
|---|
| 45 |
|
|---|
| 46 | DB=$(DESTDIR)$(BINPATH)
|
|---|
| 47 | DI=$(DESTDIR)$(INCPATH)
|
|---|
| 48 | DL=$(DESTDIR)$(LIBPATH)
|
|---|
| 49 | DM=$(DESTDIR)$(MANPATH)
|
|---|
| 50 |
|
|---|
| 51 | OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
|---|
| 52 | pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
|---|
| 53 | pngwtran.o pngmem.o pngerror.o pngpread.o
|
|---|
| 54 |
|
|---|
| 55 | OBJSDLL = $(OBJS:.o=.pic.o)
|
|---|
| 56 |
|
|---|
| 57 | .SUFFIXES: .c .o .pic.o
|
|---|
| 58 |
|
|---|
| 59 | .c.pic.o:
|
|---|
| 60 | $(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
|
|---|
| 61 |
|
|---|
| 62 | all: libpng.a $(LIBNAME).so pngtest libpng.pc libpng-config
|
|---|
| 63 |
|
|---|
| 64 | libpng.a: $(OBJS)
|
|---|
| 65 | ar rc $@ $(OBJS)
|
|---|
| 66 | $(RANLIB) $@
|
|---|
| 67 |
|
|---|
| 68 | libpng.pc:
|
|---|
| 69 | cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc
|
|---|
| 70 |
|
|---|
| 71 | libpng-config:
|
|---|
| 72 | ( cat scripts/libpng-config-head.in; \
|
|---|
| 73 | echo prefix=\"$(prefix)\"; \
|
|---|
| 74 | echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
|---|
| 75 | echo ccopts=\"-belf\"; \
|
|---|
| 76 | echo L_opts=\"-L$(LIBPATH)\"; \
|
|---|
| 77 | echo libs=\"-lpng12 -lz -lm\"; \
|
|---|
| 78 | cat scripts/libpng-config-body.in ) > libpng-config
|
|---|
| 79 | chmod +x libpng-config
|
|---|
| 80 |
|
|---|
| 81 | $(LIBNAME).so: $(LIBNAME).so.$(PNGMAJ)
|
|---|
| 82 | ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so
|
|---|
| 83 |
|
|---|
| 84 | $(LIBNAME).so.$(PNGMAJ): $(LIBNAME).so.$(PNGVER)
|
|---|
| 85 | ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ)
|
|---|
| 86 |
|
|---|
| 87 | $(LIBNAME).so.$(PNGVER): $(OBJSDLL)
|
|---|
| 88 | $(CC) -G -Wl,-h,$(LIBNAME).so.$(PNGMAJ) -o $(LIBNAME).so.$(PNGVER) \
|
|---|
| 89 | $(OBJSDLL)
|
|---|
| 90 |
|
|---|
| 91 | libpng.so.3.$(PNGMIN): $(OBJSDLL)
|
|---|
| 92 | $(CC) -G -Wl,-h,libpng.so.3 -o libpng.so.3.$(PNGMIN) \
|
|---|
| 93 | $(OBJSDLL)
|
|---|
| 94 |
|
|---|
| 95 | pngtest: pngtest.o $(LIBNAME).so
|
|---|
| 96 | LD_RUN_PATH=.:$(ZLIBLIB) $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
|---|
| 97 |
|
|---|
| 98 | test: pngtest
|
|---|
| 99 | ./pngtest
|
|---|
| 100 |
|
|---|
| 101 | install-headers: png.h pngconf.h
|
|---|
| 102 | -@if [ ! -d $(DI) ]; then mkdir $(DI); fi
|
|---|
| 103 | -@if [ ! -d $(DI)/$(LIBNAME) ]; then mkdir $(DI)/$(LIBNAME); fi
|
|---|
| 104 | -@/bin/rm -f $(DI)/png.h
|
|---|
| 105 | -@/bin/rm -f $(DI)/pngconf.h
|
|---|
| 106 | cp png.h pngconf.h $(DI)/$(LIBNAME)
|
|---|
| 107 | chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h
|
|---|
| 108 | -@/bin/rm -f $(DI)/png.h $(DI)/pngconf.h
|
|---|
| 109 | -@/bin/rm -f $(DI)/libpng
|
|---|
| 110 | (cd $(DI); ln -f -s $(LIBNAME) libpng; ln -f -s $(LIBNAME)/* .)
|
|---|
| 111 |
|
|---|
| 112 | install-static: install-headers libpng.a
|
|---|
| 113 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
|
|---|
| 114 | cp libpng.a $(DL)/$(LIBNAME).a
|
|---|
| 115 | chmod 644 $(DL)/$(LIBNAME).a
|
|---|
| 116 | -@/bin/rm -f $(DL)/libpng.a
|
|---|
| 117 | (cd $(DL); ln -f -s $(LIBNAME).a libpng.a)
|
|---|
| 118 |
|
|---|
| 119 | install-shared: install-headers $(LIBNAME).so.$(PNGVER) libpng.pc \
|
|---|
| 120 | libpng.so.3.$(PNGMIN)
|
|---|
| 121 | -@if [ ! -d $(DL) ]; then mkdir $(DL); fi
|
|---|
| 122 | -@/bin/rm -f $(DL)/$(LIBNAME).so.$(PNGVER)* $(DL)/$(LIBNAME).so
|
|---|
| 123 | -@/bin/rm -f $(DL)/libpng.so
|
|---|
| 124 | -@/bin/rm -f $(DL)/libpng.so.3
|
|---|
| 125 | -@/bin/rm -f $(DL)/libpng.so.3.$(PNGMIN)*
|
|---|
| 126 | cp $(LIBNAME).so.$(PNGVER) $(DL)
|
|---|
| 127 | cp libpng.so.3.$(PNGMIN) $(DL)
|
|---|
| 128 | chmod 755 $(DL)/$(LIBNAME).so.$(PNGVER)
|
|---|
| 129 | chmod 755 $(DL)/libpng.so.3.$(PNGMIN)
|
|---|
| 130 | (cd $(DL); \
|
|---|
| 131 | ln -f -s libpng.so.3.$(PNGMIN) libpng.so.3; \
|
|---|
| 132 | ln -f -s libpng.so.3 libpng.so; \
|
|---|
| 133 | ln -f -s $(LIBNAME).so.$(PNGVER) $(LIBNAME).so.$(PNGMAJ); \
|
|---|
| 134 | ln -f -s $(LIBNAME).so.$(PNGMAJ) $(LIBNAME).so)
|
|---|
| 135 | -@if [ ! -d $(DL)/pkgconfig ]; then mkdir $(DL)/pkgconfig; fi
|
|---|
| 136 | -@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
|
|---|
| 137 | -@/bin/rm -f $(DL)/pkgconfig/libpng.pc
|
|---|
| 138 | cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
|
|---|
| 139 | chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
|
|---|
| 140 | (cd $(DL)/pkgconfig; ln -f -s $(LIBNAME).pc libpng.pc)
|
|---|
| 141 |
|
|---|
| 142 | install-man: libpng.3 libpngpf.3 png.5
|
|---|
| 143 | -@if [ ! -d $(DM) ]; then mkdir $(DM); fi
|
|---|
| 144 | -@if [ ! -d $(DM)/man3 ]; then mkdir $(DM)/man3; fi
|
|---|
| 145 | -@/bin/rm -f $(DM)/man3/libpng.3
|
|---|
| 146 | -@/bin/rm -f $(DM)/man3/libpngpf.3
|
|---|
| 147 | cp libpng.3 $(DM)/man3
|
|---|
| 148 | cp libpngpf.3 $(DM)/man3
|
|---|
| 149 | -@if [ ! -d $(DM)/man5 ]; then mkdir $(DM)/man5; fi
|
|---|
| 150 | -@/bin/rm -f $(DM)/man5/png.5
|
|---|
| 151 | cp png.5 $(DM)/man5
|
|---|
| 152 |
|
|---|
| 153 | install-config: libpng-config
|
|---|
| 154 | -@if [ ! -d $(DB) ]; then mkdir $(DB); fi
|
|---|
| 155 | -@/bin/rm -f $(DB)/libpng-config
|
|---|
| 156 | -@/bin/rm -f $(DB)/$(LIBNAME)-config
|
|---|
| 157 | cp libpng-config $(DB)/$(LIBNAME)-config
|
|---|
| 158 | chmod 755 $(DB)/$(LIBNAME)-config
|
|---|
| 159 | (cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
|
|---|
| 160 |
|
|---|
| 161 | install: install-static install-shared install-man install-config
|
|---|
| 162 |
|
|---|
| 163 | # If you installed in $(DESTDIR), test-installed won't work until you
|
|---|
| 164 | # move the library to its final location.
|
|---|
| 165 |
|
|---|
| 166 | test-installed:
|
|---|
| 167 | $(CC) $(CFLAGS) \
|
|---|
| 168 | `$(BINPATH)/libpng12-config --cflags` pngtest.c \
|
|---|
| 169 | -L$(ZLIBLIB) \
|
|---|
| 170 | -o pngtesti `$(BINPATH)/libpng12-config --ldflags`
|
|---|
| 171 | ./pngtesti pngtest.png
|
|---|
| 172 |
|
|---|
| 173 | clean:
|
|---|
| 174 | /bin/rm -f *.o libpng.a pngtest pngout.png libpng-config \
|
|---|
| 175 | $(LIBNAME).so $(LIBNAME).so.$(PNGMAJ)* pngtest-static pngtesti \
|
|---|
| 176 | libpng.so.3.$(PNGMIN) \
|
|---|
| 177 | libpng.pc
|
|---|
| 178 |
|
|---|
| 179 | DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
|---|
| 180 | writelock:
|
|---|
| 181 | chmod a-w *.[ch35] $(DOCS) scripts/*
|
|---|
| 182 |
|
|---|
| 183 | # DO NOT DELETE THIS LINE -- make depend depends on it.
|
|---|
| 184 |
|
|---|
| 185 | png.o png.pic.o: png.h pngconf.h
|
|---|
| 186 | pngerror.o pngerror.pic.o: png.h pngconf.h
|
|---|
| 187 | pngrio.o pngrio.pic.o: png.h pngconf.h
|
|---|
| 188 | pngwio.o pngwio.pic.o: png.h pngconf.h
|
|---|
| 189 | pngmem.o pngmem.pic.o: png.h pngconf.h
|
|---|
| 190 | pngset.o pngset.pic.o: png.h pngconf.h
|
|---|
| 191 | pngget.o pngget.pic.o: png.h pngconf.h
|
|---|
| 192 | pngread.o pngread.pic.o: png.h pngconf.h
|
|---|
| 193 | pngrtran.o pngrtran.pic.o: png.h pngconf.h
|
|---|
| 194 | pngrutil.o pngrutil.pic.o: png.h pngconf.h
|
|---|
| 195 | pngtrans.o pngtrans.pic.o: png.h pngconf.h
|
|---|
| 196 | pngwrite.o pngwrite.pic.o: png.h pngconf.h
|
|---|
| 197 | pngwtran.o pngwtran.pic.o: png.h pngconf.h
|
|---|
| 198 | pngwutil.o pngwutil.pic.o: png.h pngconf.h
|
|---|
| 199 | pngpread.o pngpread.pic.o: png.h pngconf.h
|
|---|
| 200 |
|
|---|
| 201 | pngtest.o: png.h pngconf.h
|
|---|