xref: /aosp_15_r20/external/libpng/scripts/makefile.solaris (revision a67afe4df73cf47866eedc69947994b8ff839aba)
1# makefile for libpng on Solaris 2.x with gcc
2# Copyright (C) 2020-2024 Cosmin Truta
3# Copyright (C) 2004, 2006-2008, 2010-2014 Glenn Randers-Pehrson
4# Contributed by William L. Sebok, based on makefile.linux
5# Copyright (C) 1998 Greg Roelofs
6# Copyright (C) 1996, 1997 Andreas Dilger
7#
8# This code is released under the libpng license.
9# For conditions of distribution and use, see the disclaimer
10# and license in png.h
11
12# Library name:
13LIBNAME=libpng16
14PNGMAJ=16
15
16# Shared library names:
17LIBSO=$(LIBNAME).so
18LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
19
20# Utilities:
21CC=gcc
22AR=ar
23RANLIB=echo
24LN_SF=ln -f -s
25CP=cp
26RM_F=/bin/rm -f
27
28# Where the zlib library and include files are located
29# Changing these to ../zlib poses a security risk.  If you want
30# to have zlib in an adjacent directory, specify the full path instead of "..".
31#ZLIBLIB=../zlib
32#ZLIBINC=../zlib
33
34ZLIBLIB=/usr/local/lib
35ZLIBINC=/usr/local/include
36
37WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
38	-Wmissing-declarations -Wtraditional -Wcast-align \
39	-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
40CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
41CFLAGS=-O -Wall -Wextra -Wundef # $(WARNMORE) -g
42ARFLAGS=rc
43LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm # -g
44
45# Pre-built configuration
46# See scripts/pnglibconf.mak for more options
47PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
48
49OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
50       pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
51       pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
52
53OBJSDLL = $(OBJS:.o=.pic.o)
54
55.SUFFIXES:      .c .o .pic.o
56
57.c.o:
58	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
59
60.c.pic.o:
61	$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c
62
63all: libpng.a $(LIBSO) pngtest
64
65pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
66	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
67
68libpng.a: $(OBJS)
69	$(AR) $(ARFLAGS) $@ $(OBJS)
70	$(RANLIB) $@
71
72$(LIBSO): $(LIBSOMAJ)
73	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
74
75$(LIBSOMAJ): $(OBJSDLL)
76	@case "`type ld`" in *ucb*) \
77	echo; \
78	echo '## WARNING:'; \
79	echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
80	echo '## and /usr/ucb/ld.  If they do, you need to adjust your PATH'; \
81	echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
82	echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
83	echo '## at all.  If it is, things are likely to break because of'; \
84	echo '## the libucb dependency that is created.'; \
85	echo; \
86	;; \
87	esac
88	$(LD) -G -h $(LIBSOMAJ) \
89	 -o $(LIBSOMAJ) $(OBJSDLL)
90
91pngtest: pngtest.o $(LIBSO)
92	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
93
94test: pngtest
95	./pngtest
96
97install:
98	@echo "The $@ target is no longer supported by this makefile."
99	@false
100
101install-static:
102	@echo "The $@ target is no longer supported by this makefile."
103	@false
104
105install-shared:
106	@echo "The $@ target is no longer supported by this makefile."
107	@false
108
109clean:
110	$(RM_F) *.o libpng.a pngtest pngout.png
111	$(RM_F) $(LIBSO) $(LIBSOMAJ)* pnglibconf.h
112
113# DO NOT DELETE THIS LINE -- make depend depends on it.
114
115png.o      png.pic.o:      png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
116pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
117pngget.o   pngget.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
118pngmem.o   pngmem.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
119pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
120pngread.o  pngread.pic.o:  png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
121pngrio.o   pngrio.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
122pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
123pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
124pngset.o   pngset.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
125pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
126pngwio.o   pngwio.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
127pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
128pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
129pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
130
131pngtest.o: png.h pngconf.h pnglibconf.h
132