* lib/makefile.w32-in (STAT_TIME_H): New macro.
[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 GETOPT_INT_H = $(GNU_LIB)/getopt_int.h \
91 $(GNU_LIB)/getopt.h
92 MD5_H = $(GNU_LIB)/md5.h \
93 $(NT_INC)/stdint.h
94 SHA1_H = $(GNU_LIB)/sha1.h \
95 $(NT_INC)/stdint.h
96 SHA256_H = $(GNU_LIB)/sha256.h \
97 $(NT_INC)/stdint.h
98 U64_H = $(GNU_LIB)/u64.h \
99 $(NT_INC)/stdint.h
100 SHA512_H = $(GNU_LIB)/sha512.h \
101 $(U64_H)
102 STAT_TIME_H = $(GNU_LIB)/stat-time.h \
103 $(NT_INC)/sys/stat.h
104
105 $(BLD)/c-ctype.$(O) : \
106 $(GNU_LIB)/c-ctype.c \
107 $(CONFIG_H) \
108 $(C_CTYPE_H)
109
110 $(BLD)/c-strcasecmp.$(O) : \
111 $(GNU_LIB)/c-strcasecmp.c \
112 $(GNU_LIB)/c-strcase.h \
113 $(CONFIG_H) \
114 $(C_CTYPE_H)
115
116 $(BLD)/c-strncasecmp.$(O) : \
117 $(GNU_LIB)/c-strncasecmp.c \
118 $(GNU_LIB)/c-strcase.h \
119 $(CONFIG_H) \
120 $(C_CTYPE_H)
121
122 $(BLD)/dtoastr.$(O) : \
123 $(GNU_LIB)/dtoastr.c \
124 $(FTOASTR_C)
125
126 $(BLD)/dtotimespec.$(O) : \
127 $(GNU_LIB)/dtotimespec.c \
128 $(GNU_LIB)/intprops.h \
129 $(GNU_LIB)/timespec.h \
130 $(CONFIG_H)
131
132 $(BLD)/getopt.$(O) : \
133 $(GNU_LIB)/getopt.c \
134 $(GNU_LIB)/getopt.h \
135 $(GNU_LIB)/gettext.h \
136 $(NT_INC)/unistd.h \
137 $(CONFIG_H) \
138 $(GETOPT_INT_H)
139
140 $(BLD)/getopt1.$(O) : \
141 $(GNU_LIB)/getopt1.c \
142 $(GNU_LIB)/getopt.h \
143 $(CONFIG_H) \
144 $(GETOPT_INT_H)
145
146 $(BLD)/gettime.$(O) : \
147 $(GNU_LIB)/gettime.c \
148 $(GNU_LIB)/timespec.h \
149 $(NT_INC)/sys/time.h \
150 $(CONFIG_H)
151
152 $(BLD)/strftime.$(O) : \
153 $(GNU_LIB)/strftime.c \
154 $(GNU_LIB)/strftime.h \
155 $(NT_INC)/stdbool.h \
156 $(CONFIG_H)
157
158 $(BLD)/time_r.$(O) : \
159 $(GNU_LIB)/time_r.c \
160 $(CONFIG_H)
161
162 $(BLD)/timespec-add.$(O) : \
163 $(GNU_LIB)/timespec-add.c \
164 $(GNU_LIB)/intprops.h \
165 $(GNU_LIB)/timespec.h \
166 $(CONFIG_H)
167
168 $(BLD)/timespec-sub.$(O) : \
169 $(GNU_LIB)/timespec-sub.c \
170 $(GNU_LIB)/intprops.h \
171 $(GNU_LIB)/timespec.h \
172 $(CONFIG_H)
173
174 $(BLD)/md5.$(O) : \
175 $(GNU_LIB)/md5.c \
176 $(NT_INC)/stdalign.h \
177 $(NT_INC)/stdint.h \
178 $(CONFIG_H) \
179 $(MD5_H)
180
181 $(BLD)/sha1.$(O) : \
182 $(GNU_LIB)/sha1.c \
183 $(NT_INC)/stdalign.h \
184 $(NT_INC)/stdint.h \
185 $(CONFIG_H) \
186 $(SHA1_H)
187
188 $(BLD)/sha256.$(O) : \
189 $(GNU_LIB)/sha256.c \
190 $(NT_INC)/stdalign.h \
191 $(NT_INC)/stdint.h \
192 $(CONFIG_H) \
193 $(SHA256_H)
194
195 $(BLD)/sha512.$(O) : \
196 $(GNU_LIB)/sha512.c \
197 $(NT_INC)/stdalign.h \
198 $(NT_INC)/stdint.h \
199 $(CONFIG_H) \
200 $(SHA512_H)
201
202 $(BLD)/stat-time.$(O) : \
203 $(GNU_LIB)/stat-time.c \
204 $(CONFIG_H) \
205 $(STAT_TIME_H)
206
207 $(BLD)/timespec.$(O) : \
208 $(GNU_LIB)/timespec.c \
209 $(GNU_LIB)/timespec.h \
210 $(CONFIG_H)
211
212 $(BLD)/u64.$(O) : \
213 $(GNU_LIB)/u64.c \
214 $(CONFIG_H) \
215 $(U64_H)
216
217 $(BLD)/filemode.$(O) : \
218 $(GNU_LIB)/filemode.c \
219 $(CONFIG_H) \
220 $(FILEMODE_H)
221
222 # The following dependencies are for supporting parallel builds, where
223 # we must make sure $(BLD) exists before any compilation starts.
224 #
225 $(GNULIBOBJS): stamp_BLD
226
227 #
228 # Headers we would preprocess if we could.
229 #
230 getopt.h: getopt_.h
231 $(CP) $(ALL_DEPS) $@
232
233 #
234 # Maintenance
235 #
236 clean:
237 - $(DEL) $(COMPILER_TEMP_FILES)
238 - $(DEL) getopt.h
239 - $(DEL_TREE) $(OBJDIR)
240 - $(DEL) stamp_BLD
241
242 distclean: cleanall
243 - $(DEL) TAGS
244 - $(DEL) Makefile
245
246 maintainer-clean: distclean
247 - $(DEL) getopt_.h
248
249 cleanall: clean
250 - $(DEL_TREE) obj
251 - $(DEL_TREE) obj-spd
252 - $(DEL_TREE) oo
253 - $(DEL_TREE) oo-spd
254
255 # A dummy target to force other targets to be evaluated.
256 doit:
257
258 getopt_.h: getopt.in.h $(ARG_NONNULL_H)
259 $(MAKE) $(MFLAGS) getopt_.h-$(SHELLTYPE)
260
261 getopt_.h-CMD: doit
262 @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
263 @echo Run "$(MAKETYPE) getopt_h" in the lib/ subdirectory.
264 @echo You will need GNU Sed to be installed.
265 exit -1
266
267 getopt_.h-SH: doit
268 @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
269 @echo Run '"$(MAKETYPE) getopt_h"' in the lib/ subdirectory.
270 @echo You will need GNU Sed to be installed.
271 exit -1
272
273 # Generating getopt_.h from getopt.in.h.
274 #
275 # To avoid requiring all end users to install Sed, we have below
276 # a maintainer-only target that produces getopt_.h from getopt.in.h.
277 # For easier maintenance, all the strings that replace the @FOO@
278 # placeholder are defined as Make macros below.
279
280 HAVE_GETOPT_H = HAVE_GETOPT_H
281 INCLUDE_NEXT = include_next
282 PRAGMA_COLUMNS =
283 NEXT_GETOPT_H = <getopt.h>
284 ARG_NONNULL_H = ../build-aux/snippet/arg-nonnull.h
285
286 getopt_h:
287 - $(DEL) getopt_.h-t getopt_.h
288 sed -e "s!@GUARD_PREFIX@!GL!g" \
289 -e "s!@HAVE_GETOPT_H@!$(HAVE_GETOPT_H)!g" \
290 -e "s!@INCLUDE_NEXT@!$(INCLUDE_NEXT)!g" \
291 -e "s!@PRAGMA_SYSTEM_HEADER@!$(PRAGMA_SYSTEM_HEADER)!g" \
292 -e "s!@PRAGMA_COLUMNS@!$(PRAGMA_COLUMNS)!g" \
293 -e "s!@NEXT_GETOPT_H@!$(NEXT_GETOPT_H)!g" \
294 -e "/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)" \
295 -e "/^\# include_next/i # ifndef __GNUC__" \
296 -e "/^\# include_next/i # include <next_getopt.h>" \
297 -e "/^\# include_next/i # else" \
298 -e "/^\# include_next/a # endif" \
299 < getopt.in.h > getopt_.h-t
300 $(CP) getopt_.h-t getopt_.h
301 - $(DEL) getopt_.h-t