Adapt lib/makefile.w32-in to latest gnulib imports.
[bpt/emacs.git] / lib / makefile.w32-in
1 # -*- Makefile -*- for GNU Emacs on the Microsoft Windows API.
2 # Copyright (C) 2011-2012 Free Software Foundation, Inc.
3
4 # This file is part of GNU Emacs.
5
6 # GNU Emacs is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10
11 # GNU Emacs is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15
16 # You should have received a copy of the GNU General Public License
17 # along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
18
19 ALL = gnulib
20
21 .PHONY: $(ALL)
22
23 LOCAL_FLAGS = -I. -I../nt/inc -I../src
24 LIBS =
25
26 GNULIBOBJS = $(BLD)/c-ctype.$(O) \
27 $(BLD)/c-strcasecmp.$(O) \
28 $(BLD)/c-strncasecmp.$(O) \
29 $(BLD)/dtoastr.$(O) \
30 $(BLD)/dtotimespec.$(O) \
31 $(BLD)/getopt.$(O) \
32 $(BLD)/getopt1.$(O) \
33 $(BLD)/gettime.$(O) \
34 $(BLD)/strftime.$(O) \
35 $(BLD)/time_r.$(O) \
36 $(BLD)/timespec-add.$(O) \
37 $(BLD)/timespec-sub.$(O) \
38 $(BLD)/md5.$(O) \
39 $(BLD)/sha1.$(O) \
40 $(BLD)/sha256.$(O) \
41 $(BLD)/sha512.$(O) \
42 $(BLD)/stat-time.$(O) \
43 $(BLD)/timespec.$(O) \
44 $(BLD)/u64.$(O) \
45 $(BLD)/filemode.$(O)
46
47 #
48 # Build the library
49 #
50 $(BLD)/libgnu.$(A): $(GNULIBOBJS)
51 - $(DEL) $@
52 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
53
54 gnulib: $(BLD)/libgnu.$(A)
55
56 #
57 # Build everything
58 #
59 all: $(ALL)
60
61 ### TAGS ###
62
63 FRC:
64
65 TAGS: FRC
66 ../lib-src/$(BLD)/etags.exe *.c *.h
67
68 ### DEPENDENCIES ###
69
70 EMACS_ROOT = ..
71 GNU_LIB = .
72 SRC = $(EMACS_ROOT)/src
73 NT_INC = $(EMACS_ROOT)/nt/inc
74
75 C_CTYPE_H = $(GNU_LIB)/c-ctype.h \
76 $(NT_INC)/stdbool.h
77 MS_W32_H = $(NT_INC)/ms-w32.h \
78 $(NT_INC)/sys/stat.h
79 CONF_POST_H = $(SRC)/conf_post.h \
80 $(MS_W32_H)
81 CONFIG_H = $(SRC)/config.h \
82 $(CONF_POST_H)
83 FILEMODE_H = $(GNU_LIB)/filemode.h \
84 $(NT_INC)/sys/stat.h
85 FTOASTR_H = $(GNU_LIB)/ftoastr.h \
86 $(GNU_LIB)/intprops.h
87 FTOASTR_C = $(GNU_LIB)/ftoastr.c \
88 $(CONFIG_H) \
89 $(FTOASTR_H) \
90 $(GNU_LIB)/ftoastr.h
91 GETOPT_INT_H = $(GNU_LIB)/getopt_int.h \
92 $(GNU_LIB)/getopt.h
93 MD5_H = $(GNU_LIB)/md5.h \
94 $(NT_INC)/stdint.h
95 SHA1_H = $(GNU_LIB)/sha1.h \
96 $(NT_INC)/stdint.h
97 SHA256_H = $(GNU_LIB)/sha256.h \
98 $(NT_INC)/stdint.h
99 U64_H = $(GNU_LIB)/u64.h \
100 $(NT_INC)/stdint.h
101 SHA512_H = $(GNU_LIB)/sha512.h \
102 $(U64_H)
103
104 $(BLD)/c-ctype.$(O) : \
105 $(GNU_LIB)/c-ctype.c \
106 $(CONFIG_H) \
107 $(C_CTYPE_H)
108
109 $(BLD)/c-strcasecmp.$(O) : \
110 $(GNU_LIB)/c-strcasecmp.c \
111 $(GNU_LIB)/c-strcase.h \
112 $(CONFIG_H) \
113 $(C_CTYPE_H)
114
115 $(BLD)/c-strncasecmp.$(O) : \
116 $(GNU_LIB)/c-strncasecmp.c \
117 $(GNU_LIB)/c-strcase.h \
118 $(CONFIG_H) \
119 $(C_CTYPE_H)
120
121 $(BLD)/dtoastr.$(O) : \
122 $(GNU_LIB)/dtoastr.c \
123 $(FTOASTR_C)
124
125 $(BLD)/dtotimespec.$(O) : \
126 $(GNU_LIB)/dtotimespec.c \
127 $(GNU_LIB)/intprops.h \
128 $(GNU_LIB)/timespec.h \
129 $(CONFIG_H)
130
131 $(BLD)/getopt.$(O) : \
132 $(GNU_LIB)/getopt.c \
133 $(GNU_LIB)/getopt.h \
134 $(GNU_LIB)/gettext.h \
135 $(NT_INC)/unistd.h \
136 $(CONFIG_H) \
137 $(GETOPT_INT_H)
138
139 $(BLD)/getopt1.$(O) : \
140 $(GNU_LIB)/getopt1.c \
141 $(GNU_LIB)/getopt.h \
142 $(CONFIG_H) \
143 $(GETOPT_INT_H)
144
145 $(BLD)/gettime.$(O) : \
146 $(GNU_LIB)/gettime.c \
147 $(GNU_LIB)/timespec.h \
148 $(NT_INC)/sys/time.h \
149 $(CONFIG_H)
150
151 $(BLD)/strftime.$(O) : \
152 $(GNU_LIB)/strftime.c \
153 $(GNU_LIB)/strftime.h \
154 $(NT_INC)/stdbool.h \
155 $(CONFIG_H)
156
157 $(BLD)/time_r.$(O) : \
158 $(GNU_LIB)/time_r.c \
159 $(CONFIG_H)
160
161 $(BLD)/timespec-add.$(O) : \
162 $(GNU_LIB)/timespec-add.c \
163 $(GNU_LIB)/intprops.h \
164 $(GNU_LIB)/timespec.h \
165 $(CONFIG_H)
166
167 $(BLD)/timespec-sub.$(O) : \
168 $(GNU_LIB)/timespec-sub.c \
169 $(GNU_LIB)/intprops.h \
170 $(GNU_LIB)/timespec.h \
171 $(CONFIG_H)
172
173 $(BLD)/md5.$(O) : \
174 $(GNU_LIB)/md5.c \
175 $(NT_INC)/stdalign.h \
176 $(NT_INC)/stdint.h \
177 $(CONFIG_H) \
178 $(MD5_H)
179
180 $(BLD)/sha1.$(O) : \
181 $(GNU_LIB)/sha1.c \
182 $(NT_INC)/stdalign.h \
183 $(NT_INC)/stdint.h \
184 $(CONFIG_H) \
185 $(SHA1_H)
186
187 $(BLD)/sha256.$(O) : \
188 $(GNU_LIB)/sha256.c \
189 $(NT_INC)/stdalign.h \
190 $(NT_INC)/stdint.h \
191 $(CONFIG_H) \
192 $(SHA256_H)
193
194 $(BLD)/sha512.$(O) : \
195 $(GNU_LIB)/sha512.c \
196 $(NT_INC)/stdalign.h \
197 $(NT_INC)/stdint.h \
198 $(CONFIG_H) \
199 $(SHA512_H)
200
201 $(BLD)/stat-time.$(O) : \
202 $(GNU_LIB)/stat-time.h \
203 $(NT_INC)/sys/stat.h \
204 $(CONFIG_H)
205
206 $(BLD)/timespec.$(O) : \
207 $(GNU_LIB)/timespec.h \
208 $(CONFIG_H)
209
210 $(BLD)/u64.$(O) : \
211 $(U64_H) \
212 $(CONFIG_H)
213
214 $(BLD)/filemode.$(O) : \
215 $(GNU_LIB)/filemode.c \
216 $(CONFIG_H) \
217 $(FILEMODE_H)
218
219 # The following dependencies are for supporting parallel builds, where
220 # we must make sure $(BLD) exists before any compilation starts.
221 #
222 $(GNULIBOBJS): stamp_BLD
223
224 #
225 # Headers we would preprocess if we could.
226 #
227 getopt.h: getopt_.h
228 $(CP) $(ALL_DEPS) $@
229
230 #
231 # Maintenance
232 #
233 clean:
234 - $(DEL) $(COMPILER_TEMP_FILES)
235 - $(DEL) getopt.h
236 - $(DEL_TREE) $(OBJDIR)
237 - $(DEL) stamp_BLD
238
239 distclean: cleanall
240 - $(DEL) TAGS
241 - $(DEL) Makefile
242
243 maintainer-clean: distclean
244 - $(DEL) getopt_.h
245
246 cleanall: clean
247 - $(DEL_TREE) obj
248 - $(DEL_TREE) obj-spd
249 - $(DEL_TREE) oo
250 - $(DEL_TREE) oo-spd
251
252 # A dummy target to force other targets to be evaluated.
253 doit:
254
255 getopt_.h: getopt.in.h $(ARG_NONNULL_H)
256 $(MAKE) $(MFLAGS) getopt_.h-$(SHELLTYPE)
257
258 getopt_.h-CMD: doit
259 @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
260 @echo Run "$(MAKETYPE) getopt_h" in the lib/ subdirectory.
261 @echo You will need GNU Sed to be installed.
262 exit -1
263
264 getopt_.h-SH: doit
265 @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
266 @echo Run '"$(MAKETYPE) getopt_h"' in the lib/ subdirectory.
267 @echo You will need GNU Sed to be installed.
268 exit -1
269
270 # Generating getopt_.h from getopt.in.h.
271 #
272 # To avoid requiring all end users to install Sed, we have below
273 # a maintainer-only target that produces getopt_.h from getopt.in.h.
274 # For easier maintenance, all the strings that replace the @FOO@
275 # placeholder are defined as Make macros below.
276
277 HAVE_GETOPT_H = HAVE_GETOPT_H
278 INCLUDE_NEXT = include_next
279 PRAGMA_COLUMNS =
280 NEXT_GETOPT_H = <getopt.h>
281 ARG_NONNULL_H = ../build-aux/snippet/arg-nonnull.h
282
283 getopt_h:
284 - $(DEL) getopt_.h-t getopt_.h
285 sed -e "s!@GUARD_PREFIX@!GL!g" \
286 -e "s!@HAVE_GETOPT_H@!$(HAVE_GETOPT_H)!g" \
287 -e "s!@INCLUDE_NEXT@!$(INCLUDE_NEXT)!g" \
288 -e "s!@PRAGMA_SYSTEM_HEADER@!$(PRAGMA_SYSTEM_HEADER)!g" \
289 -e "s!@PRAGMA_COLUMNS@!$(PRAGMA_COLUMNS)!g" \
290 -e "s!@NEXT_GETOPT_H@!$(NEXT_GETOPT_H)!g" \
291 -e "/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)" \
292 -e "/^\# include_next/i # ifndef __GNUC__" \
293 -e "/^\# include_next/i # include <next_getopt.h>" \
294 -e "/^\# include_next/i # else" \
295 -e "/^\# include_next/a # endif" \
296 < getopt.in.h > getopt_.h-t
297 $(CP) getopt_.h-t getopt_.h
298 - $(DEL) getopt_.h-t