xref: /aosp_15_r20/external/libpng/scripts/makefile.darwin (revision a67afe4df73cf47866eedc69947994b8ff839aba)
1# makefile for libpng on Darwin / macOS
2# Copyright (C) 2020-2024 Cosmin Truta
3# Copyright (C) 2002, 2004, 2006, 2008, 2010-2014 Glenn Randers-Pehrson
4# Copyright (C) 2001 Christoph Pfisterer
5# derived from makefile.linux:
6#  Copyright (C) 1998, 1999 Greg Roelofs
7#  Copyright (C) 1996, 1997 Andreas Dilger
8#
9# This code is released under the libpng license.
10# For conditions of distribution and use, see the disclaimer
11# and license in png.h
12
13# Where the zlib library and include files are located
14ZLIBLIB=/usr/lib
15ZLIBINC=/usr/include
16
17# Library name:
18LIBNAME=libpng16
19PNGMAJ=16
20
21# Shared library names:
22LIBSO=$(LIBNAME).dylib
23LIBSOMAJ=$(LIBNAME).$(PNGMAJ).dylib
24
25# Utilities:
26CC=cc
27AR=ar
28RANLIB=ranlib
29LN_SF=ln -sf
30CP=cp
31RM_F=rm -f
32
33NOHWOPT=-DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
34        -DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
35DEFS=$(NOHWOPT)
36CPPFLAGS=-I$(ZLIBINC) $(DEFS)
37CFLAGS=-O3 -funroll-loops -Wall -Wextra -Wundef
38ARFLAGS=rc
39LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz
40
41# Pre-built configuration
42# See scripts/pnglibconf.mak for more options
43PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
44
45# File lists
46OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
47       pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
48       pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
49
50OBJSDLL = $(OBJS:.o=.pic.o)
51
52.SUFFIXES:      .c .o .pic.o
53
54.c.o:
55	$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
56
57.c.pic.o:
58	$(CC) -c $(CPPFLAGS) $(CFLAGS) -fno-common -o $@ $*.c
59
60all: libpng.a $(LIBSO) pngtest
61
62pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
63	$(CP) $(PNGLIBCONF_H_PREBUILT) $@
64
65libpng.a: $(OBJS)
66	$(AR) $(ARFLAGS) $@ $(OBJS)
67	$(RANLIB) $@
68
69$(LIBSO): $(LIBSOMAJ)
70	$(LN_SF) $(LIBSOMAJ) $(LIBSO)
71
72$(LIBSOMAJ): $(OBJSDLL)
73	$(CC) -dynamiclib \
74	 -current_version 16 -compatibility_version 16 \
75	 -o $(LIBSOMAJ) \
76	 $(OBJSDLL) -L$(ZLIBLIB) -lz
77
78pngtest: pngtest.o $(LIBSO)
79	$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
80
81test: pngtest
82	./pngtest
83
84install:
85	@echo "The $@ target is no longer supported by this makefile."
86	@false
87
88install-static:
89	@echo "The $@ target is no longer supported by this makefile."
90	@false
91
92install-shared:
93	@echo "The $@ target is no longer supported by this makefile."
94	@false
95
96clean:
97	$(RM_F) *.o libpng.a pngtest pngout.png
98	$(RM_F) $(LIBNAME).*dylib pnglibconf.h
99
100# DO NOT DELETE THIS LINE -- make depend depends on it.
101
102png.o      png.pic.o:      png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
103pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
104pngget.o   pngget.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
105pngmem.o   pngmem.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
106pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
107pngread.o  pngread.pic.o:  png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
108pngrio.o   pngrio.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
109pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
110pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
111pngset.o   pngset.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
112pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
113pngwio.o   pngwio.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
114pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
115pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
116pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
117
118pngtest.o: png.h pngconf.h pnglibconf.h
119