Merge from emacs-24; up to 2012-05-01T00:16:02Z!rgm@gnu.org
[bpt/emacs.git] / lib / makefile.w32-in
1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 # Copyright (C) 2011 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)/dtoastr.$(O) \
27 $(BLD)/dtotimespec.$(O) \
28 $(BLD)/getopt.$(O) \
29 $(BLD)/getopt1.$(O) \
30 $(BLD)/gettime.$(O) \
31 $(BLD)/strftime.$(O) \
32 $(BLD)/time_r.$(O) \
33 $(BLD)/timespec-add.$(O) \
34 $(BLD)/timespec-sub.$(O) \
35 $(BLD)/md5.$(O) \
36 $(BLD)/sha1.$(O) \
37 $(BLD)/sha256.$(O) \
38 $(BLD)/sha512.$(O) \
39 $(BLD)/filemode.$(O)
40
41 #
42 # Build the library
43 #
44 $(BLD)/libgnu.$(A): $(GNULIBOBJS)
45 - $(DEL) $@
46 $(AR) $(AR_OUT)$@ $(ALL_DEPS)
47
48 gnulib: $(BLD)/libgnu.$(A)
49
50 #
51 # Build everything
52 #
53 all: $(ALL)
54
55 ### TAGS ###
56
57 FRC:
58
59 TAGS: FRC
60 ../lib-src/$(BLD)/etags.exe *.c *.h
61
62 ### DEPENDENCIES ###
63
64 EMACS_ROOT = ..
65 SRC = .
66
67 $(BLD)/dtoastr.$(O) : \
68 $(SRC)/dtoastr.c \
69 $(SRC)/ftoastr.c \
70 $(SRC)/ftoastr.h \
71 $(SRC)/intprops.h \
72 $(EMACS_ROOT)/nt/inc/sys/stat.h \
73 $(EMACS_ROOT)/src/s/ms-w32.h \
74 $(EMACS_ROOT)/src/config.h
75
76 $(BLD)/dtotimespec.$(O) : \
77 $(SRC)/dtotimespec.c \
78 $(SRC)/intprops.h \
79 $(SRC)/timespec.h \
80 $(EMACS_ROOT)/nt/inc/sys/stat.h \
81 $(EMACS_ROOT)/src/s/ms-w32.h \
82 $(EMACS_ROOT)/src/config.h
83
84 $(BLD)/getopt.$(O) : \
85 $(SRC)/getopt.c \
86 $(SRC)/getopt.h \
87 $(SRC)/getopt_int.h \
88 $(SRC)/gettext.h \
89 $(EMACS_ROOT)/nt/inc/unistd.h \
90 $(EMACS_ROOT)/nt/inc/sys/stat.h \
91 $(EMACS_ROOT)/src/s/ms-w32.h \
92 $(EMACS_ROOT)/src/config.h
93
94 $(BLD)/getopt1.$(O) : \
95 $(SRC)/getopt1.c \
96 $(SRC)/getopt.h \
97 $(SRC)/getopt_int.h \
98 $(EMACS_ROOT)/nt/inc/sys/stat.h \
99 $(EMACS_ROOT)/src/s/ms-w32.h \
100 $(EMACS_ROOT)/src/config.h
101
102 $(BLD)/gettime.$(O) : \
103 $(SRC)/gettime.c \
104 $(SRC)/timespec.h \
105 $(EMACS_ROOT)/nt/inc/sys/time.h \
106 $(EMACS_ROOT)/nt/inc/sys/stat.h \
107 $(EMACS_ROOT)/src/s/ms-w32.h \
108 $(EMACS_ROOT)/src/config.h
109
110 $(BLD)/strftime.$(O) : \
111 $(SRC)/strftime.c \
112 $(SRC)/strftime.h \
113 $(EMACS_ROOT)/nt/inc/stdbool.h \
114 $(EMACS_ROOT)/nt/inc/sys/stat.h \
115 $(EMACS_ROOT)/src/s/ms-w32.h \
116 $(EMACS_ROOT)/src/config.h
117
118 $(BLD)/time_r.$(O) : \
119 $(SRC)/time_r.c \
120 $(EMACS_ROOT)/nt/inc/sys/stat.h \
121 $(EMACS_ROOT)/src/s/ms-w32.h \
122 $(EMACS_ROOT)/src/config.h
123
124 $(BLD)/timespec-add.$(O) : \
125 $(SRC)/timespec-add.c \
126 $(SRC)/intprops.h \
127 $(SRC)/timespec.h \
128 $(EMACS_ROOT)/nt/inc/sys/stat.h \
129 $(EMACS_ROOT)/src/s/ms-w32.h \
130 $(EMACS_ROOT)/src/config.h
131
132 $(BLD)/timespec-sub.$(O) : \
133 $(SRC)/timespec-sub.c \
134 $(SRC)/intprops.h \
135 $(SRC)/timespec.h \
136 $(EMACS_ROOT)/nt/inc/sys/stat.h \
137 $(EMACS_ROOT)/src/s/ms-w32.h \
138 $(EMACS_ROOT)/src/config.h
139
140 $(BLD)/md5.$(O) : \
141 $(SRC)/md5.c \
142 $(SRC)/md5.h \
143 $(EMACS_ROOT)/nt/inc/stdint.h \
144 $(EMACS_ROOT)/nt/inc/stdalign.h \
145 $(EMACS_ROOT)/nt/inc/sys/stat.h \
146 $(EMACS_ROOT)/src/s/ms-w32.h \
147 $(EMACS_ROOT)/src/config.h
148
149 $(BLD)/sha1.$(O) : \
150 $(SRC)/sha1.c \
151 $(SRC)/sha1.h \
152 $(EMACS_ROOT)/nt/inc/stdint.h \
153 $(EMACS_ROOT)/nt/inc/stdalign.h \
154 $(EMACS_ROOT)/nt/inc/sys/stat.h \
155 $(EMACS_ROOT)/src/s/ms-w32.h \
156 $(EMACS_ROOT)/src/config.h
157
158 $(BLD)/sha256.$(O) : \
159 $(SRC)/sha256.c \
160 $(SRC)/sha256.h \
161 $(EMACS_ROOT)/nt/inc/stdint.h \
162 $(EMACS_ROOT)/nt/inc/stdalign.h \
163 $(EMACS_ROOT)/nt/inc/sys/stat.h \
164 $(EMACS_ROOT)/src/s/ms-w32.h \
165 $(EMACS_ROOT)/src/config.h
166
167 $(BLD)/sha512.$(O) : \
168 $(SRC)/sha512.c \
169 $(SRC)/sha512.h \
170 $(EMACS_ROOT)/nt/inc/stdint.h \
171 $(EMACS_ROOT)/nt/inc/stdalign.h \
172 $(EMACS_ROOT)/nt/inc/sys/stat.h \
173 $(EMACS_ROOT)/src/s/ms-w32.h \
174 $(EMACS_ROOT)/src/config.h
175
176 $(BLD)/filemode.$(O) : \
177 $(SRC)/filemode.c \
178 $(SRC)/filemode.h \
179 $(EMACS_ROOT)/nt/inc/sys/stat.h \
180 $(EMACS_ROOT)/src/s/ms-w32.h \
181 $(EMACS_ROOT)/src/config.h
182
183 # The following dependencies are for supporting parallel builds, where
184 # we must make sure $(BLD) exists before any compilation starts.
185 #
186 $(GNULIBOBJS): stamp_BLD
187
188 #
189 # Headers we would preprocess if we could.
190 #
191 getopt.h: getopt_.h
192 $(CP) $(ALL_DEPS) $@
193
194 #
195 # Maintenance
196 #
197 clean:
198 - $(DEL) $(COMPILER_TEMP_FILES)
199 - $(DEL) getopt.h
200 - $(DEL_TREE) $(OBJDIR)
201 - $(DEL) stamp_BLD
202
203 distclean: cleanall
204 - $(DEL) TAGS
205 - $(DEL) Makefile
206
207 maintainer-clean: distclean
208 - $(DEL) getopt_.h
209
210 cleanall: clean
211 - $(DEL_TREE) obj
212 - $(DEL_TREE) obj-spd
213 - $(DEL_TREE) oo
214 - $(DEL_TREE) oo-spd
215
216 # A dummy target to force other targets to be evaluated.
217 doit:
218
219 getopt_.h: getopt.in.h $(ARG_NONNULL_H)
220 $(MAKE) $(MFLAGS) getopt_.h-$(SHELLTYPE)
221
222 getopt_.h-CMD: doit
223 @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
224 @echo Run "$(MAKETYPE) getopt_h" in the lib/ subdirectory.
225 @echo You will need GNU Sed to be installed.
226 exit -1
227
228 getopt_.h-SH: doit
229 @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
230 @echo Run '"$(MAKETYPE) getopt_h"' in the lib/ subdirectory.
231 @echo You will need GNU Sed to be installed.
232 exit -1
233
234 # Generating getopt_.h from getopt.in.h.
235 #
236 # To avoid requiring all end users to install Sed, we have below
237 # a maintainer-only target that produces getopt_.h from getopt.in.h.
238 # For easier maintenance, all the strings that replace the @FOO@
239 # placeholder are defined as Make macros below.
240
241 HAVE_GETOPT_H = HAVE_GETOPT_H
242 INCLUDE_NEXT = include_next
243 PRAGMA_COLUMNS =
244 NEXT_GETOPT_H = <getopt.h>
245 ARG_NONNULL_H = ../build-aux/snippet/arg-nonnull.h
246
247 getopt_h:
248 - $(DEL) getopt_.h-t getopt_.h
249 sed -e "s!@GUARD_PREFIX@!GL!g" \
250 -e "s!@HAVE_GETOPT_H@!$(HAVE_GETOPT_H)!g" \
251 -e "s!@INCLUDE_NEXT@!$(INCLUDE_NEXT)!g" \
252 -e "s!@PRAGMA_SYSTEM_HEADER@!$(PRAGMA_SYSTEM_HEADER)!g" \
253 -e "s!@PRAGMA_COLUMNS@!$(PRAGMA_COLUMNS)!g" \
254 -e "s!@NEXT_GETOPT_H@!$(NEXT_GETOPT_H)!g" \
255 -e "/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)" \
256 -e "/^\# include_next/i # ifndef __GNUC__" \
257 -e "/^\# include_next/i # include <next_getopt.h>" \
258 -e "/^\# include_next/i # else" \
259 -e "/^\# include_next/a # endif" \
260 < getopt.in.h > getopt_.h-t
261 $(CP) getopt_.h-t getopt_.h
262 - $(DEL) getopt_.h-t