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