Mercurial > hg > CbC > CbC_gcc
comparison zlib/win32/Makefile.gcc @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | ae3a4bfb450b |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 # Makefile for zlib, derived from Makefile.dj2. | 1 # Makefile for zlib, derived from Makefile.dj2. |
2 # Modified for mingw32 by C. Spieler, 6/16/98. | 2 # Modified for mingw32 by C. Spieler, 6/16/98. |
3 # Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003. | 3 # Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003. |
4 # Last updated: 1-Aug-2003. | 4 # Last updated: Mar 2012. |
5 # Tested under Cygwin and MinGW. | 5 # Tested under Cygwin and MinGW. |
6 | 6 |
7 # Copyright (C) 1995-2003 Jean-loup Gailly. | 7 # Copyright (C) 1995-2003 Jean-loup Gailly. |
8 # For conditions of distribution and use, see copyright notice in zlib.h | 8 # For conditions of distribution and use, see copyright notice in zlib.h |
9 | 9 |
10 # To compile, or to compile and test, type: | 10 # To compile, or to compile and test, type from the top level zlib directory: |
11 # | 11 # |
12 # make -fmakefile.gcc; make test testdll -fmakefile.gcc | 12 # make -fwin32/Makefile.gcc; make test testdll -fwin32/Makefile.gcc |
13 # | 13 # |
14 # To use the asm code, type: | 14 # To use the asm code, type: |
15 # cp contrib/asm?86/match.S ./match.S | 15 # cp contrib/asm?86/match.S ./match.S |
16 # make LOC=-DASMV OBJA=match.o -fmakefile.gcc | 16 # make LOC=-DASMV OBJA=match.o -fwin32/Makefile.gcc |
17 # | 17 # |
18 # To install libz.a, zconf.h and zlib.h in the system directories, type: | 18 # To install libz.a, zconf.h and zlib.h in the system directories, type: |
19 # | 19 # |
20 # make install -fmakefile.gcc | 20 # make install -fwin32/Makefile.gcc |
21 # | |
22 # BINARY_PATH, INCLUDE_PATH and LIBRARY_PATH must be set. | |
23 # | |
24 # To install the shared lib, append SHARED_MODE=1 to the make command : | |
25 # | |
26 # make install -fwin32/Makefile.gcc SHARED_MODE=1 | |
21 | 27 |
22 # Note: | 28 # Note: |
23 # If the platform is *not* MinGW (e.g. it is Cygwin or UWIN), | 29 # If the platform is *not* MinGW (e.g. it is Cygwin or UWIN), |
24 # the DLL name should be changed from "zlib1.dll". | 30 # the DLL name should be changed from "zlib1.dll". |
25 | 31 |
26 STATICLIB = libz.a | 32 STATICLIB = libz.a |
27 SHAREDLIB = zlib1.dll | 33 SHAREDLIB = zlib1.dll |
28 IMPLIB = libzdll.a | 34 IMPLIB = libz.dll.a |
35 | |
36 # | |
37 # Set to 1 if shared object needs to be installed | |
38 # | |
39 SHARED_MODE=0 | |
29 | 40 |
30 #LOC = -DASMV | 41 #LOC = -DASMV |
31 #LOC = -DDEBUG -g | 42 #LOC = -DZLIB_DEBUG -g |
32 | 43 |
33 CC = gcc | 44 PREFIX = |
45 CC = $(PREFIX)gcc | |
34 CFLAGS = $(LOC) -O3 -Wall | 46 CFLAGS = $(LOC) -O3 -Wall |
35 | 47 |
36 AS = $(CC) | 48 AS = $(CC) |
37 ASFLAGS = $(LOC) -Wall | 49 ASFLAGS = $(LOC) -Wall |
38 | 50 |
39 LD = $(CC) | 51 LD = $(CC) |
40 LDFLAGS = $(LOC) -s | 52 LDFLAGS = $(LOC) |
41 | 53 |
42 AR = ar | 54 AR = $(PREFIX)ar |
43 ARFLAGS = rcs | 55 ARFLAGS = rcs |
44 | 56 |
45 RC = windres | 57 RC = $(PREFIX)windres |
46 RCFLAGS = --define GCC_WINDRES | 58 RCFLAGS = --define GCC_WINDRES |
59 | |
60 STRIP = $(PREFIX)strip | |
47 | 61 |
48 CP = cp -fp | 62 CP = cp -fp |
49 # If GNU install is available, replace $(CP) with install. | 63 # If GNU install is available, replace $(CP) with install. |
50 INSTALL = $(CP) | 64 INSTALL = $(CP) |
51 RM = rm -f | 65 RM = rm -f |
52 | 66 |
53 prefix = /usr/local | 67 prefix ?= /usr/local |
54 exec_prefix = $(prefix) | 68 exec_prefix = $(prefix) |
55 | 69 |
56 OBJS = adler32.o compress.o crc32.o deflate.o gzio.o infback.o \ | 70 OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \ |
57 inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o | 71 gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o |
58 OBJA = | 72 OBJA = |
59 | 73 |
60 all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example minigzip example_d minigzip_d | 74 all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe |
61 | 75 |
62 test: example minigzip | 76 test: example.exe minigzip.exe |
63 ./example | 77 ./example |
64 echo hello world | ./minigzip | ./minigzip -d | 78 echo hello world | ./minigzip | ./minigzip -d |
65 | 79 |
66 testdll: example_d minigzip_d | 80 testdll: example_d.exe minigzip_d.exe |
67 ./example_d | 81 ./example_d |
68 echo hello world | ./minigzip_d | ./minigzip_d -d | 82 echo hello world | ./minigzip_d | ./minigzip_d -d |
69 | 83 |
70 .c.o: | 84 .c.o: |
71 $(CC) $(CFLAGS) -c -o $@ $< | 85 $(CC) $(CFLAGS) -c -o $@ $< |
77 $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA) | 91 $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA) |
78 | 92 |
79 $(IMPLIB): $(SHAREDLIB) | 93 $(IMPLIB): $(SHAREDLIB) |
80 | 94 |
81 $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o | 95 $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o |
82 dllwrap --driver-name $(CC) --def win32/zlib.def \ | 96 $(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \ |
83 --implib $(IMPLIB) -o $@ $(OBJS) $(OBJA) zlibrc.o | 97 -o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o |
84 strip $@ | 98 $(STRIP) $@ |
85 | 99 |
86 example: example.o $(STATICLIB) | 100 example.exe: example.o $(STATICLIB) |
87 $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB) | 101 $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB) |
102 $(STRIP) $@ | |
88 | 103 |
89 minigzip: minigzip.o $(STATICLIB) | 104 minigzip.exe: minigzip.o $(STATICLIB) |
90 $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB) | 105 $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB) |
106 $(STRIP) $@ | |
91 | 107 |
92 example_d: example.o $(IMPLIB) | 108 example_d.exe: example.o $(IMPLIB) |
93 $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB) | 109 $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB) |
110 $(STRIP) $@ | |
94 | 111 |
95 minigzip_d: minigzip.o $(IMPLIB) | 112 minigzip_d.exe: minigzip.o $(IMPLIB) |
96 $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB) | 113 $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB) |
114 $(STRIP) $@ | |
115 | |
116 example.o: test/example.c zlib.h zconf.h | |
117 $(CC) $(CFLAGS) -I. -c -o $@ test/example.c | |
118 | |
119 minigzip.o: test/minigzip.c zlib.h zconf.h | |
120 $(CC) $(CFLAGS) -I. -c -o $@ test/minigzip.c | |
97 | 121 |
98 zlibrc.o: win32/zlib1.rc | 122 zlibrc.o: win32/zlib1.rc |
99 $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc | 123 $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc |
100 | 124 |
101 | |
102 # INCLUDE_PATH and LIBRARY_PATH must be set. | |
103 | |
104 .PHONY: install uninstall clean | 125 .PHONY: install uninstall clean |
105 | 126 |
106 install: zlib.h zconf.h $(LIB) | 127 install: zlib.h zconf.h $(STATICLIB) $(IMPLIB) |
107 -@if not exist $(INCLUDE_PATH)/nul mkdir $(INCLUDE_PATH) | 128 @if test -z "$(DESTDIR)$(INCLUDE_PATH)" -o -z "$(DESTDIR)$(LIBRARY_PATH)" -o -z "$(DESTDIR)$(BINARY_PATH)"; then \ |
108 -@if not exist $(LIBRARY_PATH)/nul mkdir $(LIBRARY_PATH) | 129 echo INCLUDE_PATH, LIBRARY_PATH, and BINARY_PATH must be specified; \ |
109 -$(INSTALL) zlib.h $(INCLUDE_PATH) | 130 exit 1; \ |
110 -$(INSTALL) zconf.h $(INCLUDE_PATH) | 131 fi |
111 -$(INSTALL) $(STATICLIB) $(LIBRARY_PATH) | 132 -@mkdir -p '$(DESTDIR)$(INCLUDE_PATH)' |
112 -$(INSTALL) $(IMPLIB) $(LIBRARY_PATH) | 133 -@mkdir -p '$(DESTDIR)$(LIBRARY_PATH)' '$(DESTDIR)$(LIBRARY_PATH)'/pkgconfig |
134 -if [ "$(SHARED_MODE)" = "1" ]; then \ | |
135 mkdir -p '$(DESTDIR)$(BINARY_PATH)'; \ | |
136 $(INSTALL) $(SHAREDLIB) '$(DESTDIR)$(BINARY_PATH)'; \ | |
137 $(INSTALL) $(IMPLIB) '$(DESTDIR)$(LIBRARY_PATH)'; \ | |
138 fi | |
139 -$(INSTALL) zlib.h '$(DESTDIR)$(INCLUDE_PATH)' | |
140 -$(INSTALL) zconf.h '$(DESTDIR)$(INCLUDE_PATH)' | |
141 -$(INSTALL) $(STATICLIB) '$(DESTDIR)$(LIBRARY_PATH)' | |
142 sed \ | |
143 -e 's|@prefix@|${prefix}|g' \ | |
144 -e 's|@exec_prefix@|${exec_prefix}|g' \ | |
145 -e 's|@libdir@|$(LIBRARY_PATH)|g' \ | |
146 -e 's|@sharedlibdir@|$(LIBRARY_PATH)|g' \ | |
147 -e 's|@includedir@|$(INCLUDE_PATH)|g' \ | |
148 -e 's|@VERSION@|'`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' zlib.h`'|g' \ | |
149 zlib.pc.in > '$(DESTDIR)$(LIBRARY_PATH)'/pkgconfig/zlib.pc | |
113 | 150 |
114 uninstall: | 151 uninstall: |
115 -$(RM) $(INCLUDE_PATH)/zlib.h | 152 -if [ "$(SHARED_MODE)" = "1" ]; then \ |
116 -$(RM) $(INCLUDE_PATH)/zconf.h | 153 $(RM) '$(DESTDIR)$(BINARY_PATH)'/$(SHAREDLIB); \ |
117 -$(RM) $(LIBRARY_PATH)/$(STATICLIB) | 154 $(RM) '$(DESTDIR)$(LIBRARY_PATH)'/$(IMPLIB); \ |
118 -$(RM) $(LIBRARY_PATH)/$(IMPLIB) | 155 fi |
156 -$(RM) '$(DESTDIR)$(INCLUDE_PATH)'/zlib.h | |
157 -$(RM) '$(DESTDIR)$(INCLUDE_PATH)'/zconf.h | |
158 -$(RM) '$(DESTDIR)$(LIBRARY_PATH)'/$(STATICLIB) | |
119 | 159 |
120 clean: | 160 clean: |
121 -$(RM) $(STATICLIB) | 161 -$(RM) $(STATICLIB) |
122 -$(RM) $(SHAREDLIB) | 162 -$(RM) $(SHAREDLIB) |
123 -$(RM) $(IMPLIB) | 163 -$(RM) $(IMPLIB) |
127 | 167 |
128 adler32.o: zlib.h zconf.h | 168 adler32.o: zlib.h zconf.h |
129 compress.o: zlib.h zconf.h | 169 compress.o: zlib.h zconf.h |
130 crc32.o: crc32.h zlib.h zconf.h | 170 crc32.o: crc32.h zlib.h zconf.h |
131 deflate.o: deflate.h zutil.h zlib.h zconf.h | 171 deflate.o: deflate.h zutil.h zlib.h zconf.h |
132 example.o: zlib.h zconf.h | 172 gzclose.o: zlib.h zconf.h gzguts.h |
133 gzio.o: zutil.h zlib.h zconf.h | 173 gzlib.o: zlib.h zconf.h gzguts.h |
174 gzread.o: zlib.h zconf.h gzguts.h | |
175 gzwrite.o: zlib.h zconf.h gzguts.h | |
134 inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | 176 inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h |
135 inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | 177 inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h |
136 infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h | 178 infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h |
137 inftrees.o: zutil.h zlib.h zconf.h inftrees.h | 179 inftrees.o: zutil.h zlib.h zconf.h inftrees.h |
138 minigzip.o: zlib.h zconf.h | |
139 trees.o: deflate.h zutil.h zlib.h zconf.h trees.h | 180 trees.o: deflate.h zutil.h zlib.h zconf.h trees.h |
140 uncompr.o: zlib.h zconf.h | 181 uncompr.o: zlib.h zconf.h |
141 zutil.o: zutil.h zlib.h zconf.h | 182 zutil.o: zutil.h zlib.h zconf.h |