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