]> git.tdb.fi Git - ext/libpng.git/blob - scripts/makefile.msys
Adjust library name to match upstream
[ext/libpng.git] / scripts / makefile.msys
1 # makefile for libpng using MSYS/gcc (shared, static library)
2 # Copyright (C) 2019-2022 Cosmin Truta
3 # Copyright (C) 2012 Glenn Randers-Pehrson and Christopher M. Wheeler
4 #
5 # Portions taken from makefile.linux and makefile.gcc:
6 # Copyright (C) 2000 Cosmin Truta
7 # Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and
8 # Glenn Randers-Pehrson
9 # Copyright (C) 1996, 1997 Andreas Dilger
10 # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
11 #
12 # This code is released under the libpng license.
13 # For conditions of distribution and use, see the disclaimer
14 # and license in png.h
15
16 # Library name:
17 LIBNAME=libpng16
18 PNGMAJ=16
19
20 # Shared library names:
21 LIBSO=$(LIBNAME).dll
22 LIBSOMAJ=$(LIBNAME).dll.$(PNGMAJ)
23
24 # Where the zlib library and include files are located.
25 #ZLIBLIB=../zlib
26 #ZLIBINC=../zlib
27 ZLIBLIB=/usr/local/lib
28 ZLIBINC=/usr/local/include
29
30 # Compiler, linker, lib and other tools
31 CC = gcc
32 LD = $(CC)
33 AR_RC = ar rcs
34 RANLIB = ranlib
35 CP = cp
36 RM_F = rm -rf
37 MKDIR_P=mkdir -p
38 LN_SF=ln -sf
39
40 CPPFLAGS = # -DPNG_DEBUG=5
41 CFLAGS = -O2 -Wall -Wextra -Wundef # -g
42 LDFLAGS = # -g
43 LIBS = -lz -lm
44
45 # File extensions
46 EXEEXT=.exe
47
48 # Pre-built configuration
49 # See scripts/pnglibconf.mak for more options
50 PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
51
52 # File lists
53 OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
54        pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
55        pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
56
57 # Targets
58 all: static shared
59
60 pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
61         $(CP) $(PNGLIBCONF_H_PREBUILT) $@
62
63 .c.o:
64         $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
65
66 static: libpng.a pngtest$(EXEEXT)
67
68 shared: $(LIBSOMAJ)
69         $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSO)
70
71 $(LIBSO): $(LIBSOMAJ)
72         $(LN_SF) $(LIBSOMAJ) $(LIBSO)
73
74 $(LIBSOMAJ):
75         $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ)
76
77 libpng.a: $(OBJS)
78         $(AR_RC) $@ $(OBJS)
79         $(RANLIB) $@
80
81 install:
82         @echo "The $@ target is no longer supported by this makefile."
83         @false
84
85 install-static:
86         @echo "The $@ target is no longer supported by this makefile."
87         @false
88
89 install-shared:
90         @echo "The $@ target is no longer supported by this makefile."
91         @false
92
93 test: pngtest$(EXEEXT)
94         ./pngtest$(EXEEXT)
95
96 pngtest$(EXEEXT): pngtest.o libpng.a
97         $(LD) $(LDFLAGS) -o $@ pngtest.o libpng.a $(LIBS)
98
99 clean:
100         $(RM_F) $(OBJS) libpng.a
101         $(RM_F) $(LIBSO) $(LIBSOMAJ) pnglibconf.h
102         $(RM_F) pngtest*.o pngtest$(EXEEXT) pngout.png
103
104 png.o:      png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
105 pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
106 pngget.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
107 pngmem.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
108 pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
109 pngread.o:  png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
110 pngrio.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
111 pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
112 pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
113 pngset.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
114 pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
115 pngwio.o:   png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
116 pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
117 pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
118 pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
119
120 pngtest.o:  png.h pngconf.h pnglibconf.h