Merge branch 'upstream' into tizen
[platform/upstream/libpng.git] / scripts / makefile.darwin
1 # makefile for libpng on Darwin / macOS
2 # Copyright (C) 2020-2022 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
14 ZLIBLIB=/usr/lib
15 ZLIBINC=/usr/include
16
17 # Library name:
18 LIBNAME=libpng16
19 PNGMAJ=16
20
21 # Shared library names:
22 LIBSO=$(LIBNAME).dylib
23 LIBSOMAJ=$(LIBNAME).$(PNGMAJ).dylib
24
25 # Utilities:
26 CC=cc
27 AR_RC=ar rc
28 RANLIB=ranlib
29 MKDIR_P=mkdir -p
30 LN_SF=ln -sf
31 CP=cp
32 RM_F=rm -f
33
34 NOHWOPT=-DPNG_ARM_NEON_OPT=0 -DPNG_MIPS_MSA_OPT=0 \
35         -DPNG_POWERPC_VSX_OPT=0 -DPNG_INTEL_SSE_OPT=0
36 DEFS=$(NOHWOPT)
37 CPPFLAGS=-I$(ZLIBINC) $(DEFS)
38 CFLAGS=-O3 -funroll-loops -Wall -Wextra -Wundef
39 LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz
40
41 # Pre-built configuration
42 # See scripts/pnglibconf.mak for more options
43 PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
44
45 # File lists
46 OBJS = 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
50 OBJSDLL = $(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
60 all: libpng.a $(LIBSO) pngtest
61
62 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
63         $(CP) $(PNGLIBCONF_H_PREBUILT) $@
64
65 libpng.a: $(OBJS)
66         $(AR_RC) $@ $(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
78 pngtest: pngtest.o $(LIBSO)
79         $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
80
81 test: pngtest
82         ./pngtest
83
84 install:
85         @echo "The $@ target is no longer supported by this makefile."
86         @false
87
88 install-static:
89         @echo "The $@ target is no longer supported by this makefile."
90         @false
91
92 install-shared:
93         @echo "The $@ target is no longer supported by this makefile."
94         @false
95
96 clean:
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
102 png.o      png.pic.o:      png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
103 pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
104 pngget.o   pngget.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
105 pngmem.o   pngmem.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
106 pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
107 pngread.o  pngread.pic.o:  png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
108 pngrio.o   pngrio.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
109 pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
110 pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
111 pngset.o   pngset.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
112 pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
113 pngwio.o   pngwio.pic.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
114 pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
115 pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
116 pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
117
118 pngtest.o: png.h pngconf.h pnglibconf.h