blob: 86c4964388a605235f88045d871244b3e133fe7c [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001# makefile for libpng on Linux ELF with gcc
2# Copyright (C) 1998, 1999 Greg Roelofs
3# Copyright (C) 1996, 1997 Andreas Dilger
4# For conditions of distribution and use, see copyright notice in png.h
5include $(COMMON_BASE_MK)
6#CC=gcc
7
8# where "make install" puts libpng.a, libpng.so*, png.h and pngconf.h
9#prefix=/usr/local
10
11# Where the zlib library and include files are located
12#ZLIBLIB=/usr/local/lib
13#ZLIBINC=/usr/local/include
14ZLIBLIB=../zlib/build
15ZLIBINC=../zlib/zlib-1.2.11
16LIBTARGET=libpng.a
17
18
19
20ALIGN=
21# for i386:
22#ALIGN=-malign-loops=2 -malign-functions=2
23
24WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
25 -Wmissing-declarations -Wtraditional -Wcast-align \
26 -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
27
28# for pgcc version 2.95.1, -O3 is buggy; don't use it.
29
30CFLAGS += -I$(ZLIBINC) -Wall -O3 -funroll-loops \
31 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
32#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz -lm
33
34#RANLIB=ranlib
35#RANLIB=echo
36
37# read libpng.txt or png.h to see why PNGMAJ is 2. You should not
38# have to change it.
39PNGMAJ = 2
40PNGMIN = 1.0.12
41PNGVER = $(PNGMAJ).$(PNGMIN)
42
43#INCPATH=$(prefix)/include
44#LIBPATH=$(prefix)/lib
45
46OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
47 pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
48 pngwtran.o pngmem.o pngerror.o pngpread.o
49
50OBJSDLL = $(OBJS:.o=.pic.o)
51
52.SUFFIXES: .c .o .pic.o
53
54.c.pic.o:
55 $(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
56
57#all: libpng.a libpng.so pngtest
58all: $(LIBTARGET)
59#libpng.so
60
61#shared: all install
62
63
64libpng.a: $(OBJS)
65 $(AR) -rv $@ $(OBJS)
66# $(RANLIB) $@
67# $(INSTALL) -m 644 libpng.a $(ROOT_PATH)/lib/lib
68
69libpng.so: libpng.so.$(PNGMAJ)
70 ln -sf libpng.so.$(PNGMAJ) libpng.so
71
72libpng.so.$(PNGMAJ): libpng.so.$(PNGVER)
73 ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ)
74
75libpng.so.$(PNGVER): $(OBJSDLL)
76 $(CC) -shared -Wl,-soname,libpng.so.$(PNGMAJ) -o libpng.so.$(PNGVER) \
77 $(OBJSDLL) -L$(ZLIBLIB) -lz -lm -lc
78
79pngtest: pngtest.o libpng.so
80 $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
81
82test: pngtest
83 ./pngtest
84
85install: libpng.a libpng.so.$(PNGVER)
86 -@if [ ! -d $(INCPATH) ]; then mkdir $(INCPATH); fi
87 -@if [ ! -d $(LIBPATH) ]; then mkdir $(LIBPATH); fi
88 cp png.h pngconf.h $(INCPATH)
89 chmod 644 $(INCPATH)/png.h $(INCPATH)/pngconf.h
90 cp libpng.a $(LIBPATH)
91# cp libpng.a libpng.so.$(PNGVER) $(LIBPATH)
92# chmod 755 $(LIBPATH)/libpng.so.$(PNGVER)
93# -@/bin/rm -f $(LIBPATH)/libpng.so.$(PNGMAJ) $(LIBPATH)/libpng.so
94# (cd $(LIBPATH); ln -sf libpng.so.$(PNGVER) libpng.so.$(PNGMAJ); \
95# ln -sf libpng.so.$(PNGMAJ) libpng.so)
96
97romfs:
98 if [ "$(CONFIG_X86)" = "y" ]; then \
99 [ -d $(ROMFSDIR)/lib ] || mkdir -p $(ROMFSDIR)/lib ; \
100 $(ROMFSINST) libpng.so.2 /lib/libpng.so.2 ; \
101 fi
102
103clean:
104 -/bin/rm -f *.o libpng.a libpng.so* pngtest pngout.png
105
106DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
107writelock:
108 chmod a-w *.[ch35] $(DOCS) scripts/*
109
110# DO NOT DELETE THIS LINE -- make depend depends on it.
111
112png.o png.pic.o: png.h pngconf.h
113pngerror.o pngerror.pic.o: png.h pngconf.h
114pngrio.o pngrio.pic.o: png.h pngconf.h
115pngwio.o pngwio.pic.o: png.h pngconf.h
116pngmem.o pngmem.pic.o: png.h pngconf.h
117pngset.o pngset.pic.o: png.h pngconf.h
118pngget.o pngget.pic.o: png.h pngconf.h
119pngread.o pngread.pic.o: png.h pngconf.h
120pngrtran.o pngrtran.pic.o: png.h pngconf.h
121pngrutil.o pngrutil.pic.o: png.h pngconf.h
122pngtrans.o pngtrans.pic.o: png.h pngconf.h
123pngwrite.o pngwrite.pic.o: png.h pngconf.h
124pngwtran.o pngwtran.pic.o: png.h pngconf.h
125pngwutil.o pngwutil.pic.o: png.h pngconf.h
126pngpread.o pngpread.pic.o: png.h pngconf.h
127
128pngtest.o: png.h pngconf.h