Add gnulib files for Bug#11786 fix.
[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
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 \
388cdec0
EZ
80 $(EMACS_ROOT)/nt/inc/sys/stat.h \
81 $(EMACS_ROOT)/src/s/ms-w32.h \
82 $(EMACS_ROOT)/src/config.h
83
f915f0f7
EZ
84$(BLD)/getopt.$(O) : \
85 $(SRC)/getopt.c \
86 $(SRC)/getopt.h \
87 $(SRC)/getopt_int.h \
f1f81baa
JB
88 $(SRC)/gettext.h \
89 $(EMACS_ROOT)/nt/inc/unistd.h \
90 $(EMACS_ROOT)/nt/inc/sys/stat.h \
f915f0f7 91 $(EMACS_ROOT)/src/s/ms-w32.h \
f915f0f7
EZ
92 $(EMACS_ROOT)/src/config.h
93
94$(BLD)/getopt1.$(O) : \
95 $(SRC)/getopt1.c \
96 $(SRC)/getopt.h \
97 $(SRC)/getopt_int.h \
f1f81baa 98 $(EMACS_ROOT)/nt/inc/sys/stat.h \
f915f0f7 99 $(EMACS_ROOT)/src/s/ms-w32.h \
f915f0f7
EZ
100 $(EMACS_ROOT)/src/config.h
101
388cdec0
EZ
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
70b0d280
EZ
110$(BLD)/strftime.$(O) : \
111 $(SRC)/strftime.c \
112 $(SRC)/strftime.h \
113 $(EMACS_ROOT)/nt/inc/stdbool.h \
f1f81baa 114 $(EMACS_ROOT)/nt/inc/sys/stat.h \
70b0d280 115 $(EMACS_ROOT)/src/s/ms-w32.h \
70b0d280
EZ
116 $(EMACS_ROOT)/src/config.h
117
118$(BLD)/time_r.$(O) : \
119 $(SRC)/time_r.c \
f1f81baa 120 $(EMACS_ROOT)/nt/inc/sys/stat.h \
70b0d280 121 $(EMACS_ROOT)/src/s/ms-w32.h \
70b0d280
EZ
122 $(EMACS_ROOT)/src/config.h
123
388cdec0
EZ
124$(BLD)/timespec-add.$(O) : \
125 $(SRC)/timespec-add.c \
126 $(SRC)/intprops.h \
127 $(SRC)/timespec.h \
388cdec0
EZ
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 \
388cdec0
EZ
136 $(EMACS_ROOT)/nt/inc/sys/stat.h \
137 $(EMACS_ROOT)/src/s/ms-w32.h \
138 $(EMACS_ROOT)/src/config.h
139
32159fc3 140$(BLD)/md5.$(O) : \
25c51af3
EZ
141 $(SRC)/md5.c \
142 $(SRC)/md5.h \
9f8370e6 143 $(EMACS_ROOT)/nt/inc/stdint.h \
cd376509 144 $(EMACS_ROOT)/nt/inc/stdalign.h \
f1f81baa 145 $(EMACS_ROOT)/nt/inc/sys/stat.h \
32159fc3 146 $(EMACS_ROOT)/src/s/ms-w32.h \
25c51af3
EZ
147 $(EMACS_ROOT)/src/config.h
148
13c3daa4
LL
149$(BLD)/sha1.$(O) : \
150 $(SRC)/sha1.c \
151 $(SRC)/sha1.h \
152 $(EMACS_ROOT)/nt/inc/stdint.h \
cd376509 153 $(EMACS_ROOT)/nt/inc/stdalign.h \
13c3daa4
LL
154 $(EMACS_ROOT)/nt/inc/sys/stat.h \
155 $(EMACS_ROOT)/src/s/ms-w32.h \
13c3daa4
LL
156 $(EMACS_ROOT)/src/config.h
157
3ce9d0d4
LL
158$(BLD)/sha256.$(O) : \
159 $(SRC)/sha256.c \
160 $(SRC)/sha256.h \
161 $(EMACS_ROOT)/nt/inc/stdint.h \
cd376509 162 $(EMACS_ROOT)/nt/inc/stdalign.h \
3ce9d0d4
LL
163 $(EMACS_ROOT)/nt/inc/sys/stat.h \
164 $(EMACS_ROOT)/src/s/ms-w32.h \
3ce9d0d4
LL
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 \
cd376509 171 $(EMACS_ROOT)/nt/inc/stdalign.h \
3ce9d0d4
LL
172 $(EMACS_ROOT)/nt/inc/sys/stat.h \
173 $(EMACS_ROOT)/src/s/ms-w32.h \
3ce9d0d4
LL
174 $(EMACS_ROOT)/src/config.h
175
25c51af3
EZ
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 \
25c51af3 181 $(EMACS_ROOT)/src/config.h
32159fc3 182
f915f0f7
EZ
183# The following dependencies are for supporting parallel builds, where
184# we must make sure $(BLD) exists before any compilation starts.
185#
cc06e7e7 186$(GNULIBOBJS): stamp_BLD
f915f0f7
EZ
187
188#
189# Headers we would preprocess if we could.
190#
191getopt.h: getopt_.h
192 $(CP) $(ALL_DEPS) $@
193
194#
195# Maintenance
196#
197clean:
198 - $(DEL) $(COMPILER_TEMP_FILES)
199 - $(DEL) getopt.h
200 - $(DEL_TREE) $(OBJDIR)
201 - $(DEL) stamp_BLD
202
203distclean: cleanall
204 - $(DEL) TAGS
205 - $(DEL) Makefile
206
207maintainer-clean: distclean
208 - $(DEL) getopt_.h
209
210cleanall: 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.
217doit:
218
219getopt_.h: getopt.in.h $(ARG_NONNULL_H)
220 $(MAKE) $(MFLAGS) getopt_.h-$(SHELLTYPE)
221
222getopt_.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
228getopt_.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
241HAVE_GETOPT_H = HAVE_GETOPT_H
242INCLUDE_NEXT = include_next
f915f0f7
EZ
243PRAGMA_COLUMNS =
244NEXT_GETOPT_H = <getopt.h>
24e0f6b1 245ARG_NONNULL_H = ../build-aux/snippet/arg-nonnull.h
f915f0f7
EZ
246
247getopt_h:
248 - $(DEL) getopt_.h-t getopt_.h
6a3e57bb
PE
249 sed -e "s!@GUARD_PREFIX@!GL!g" \
250 -e "s!@HAVE_GETOPT_H@!$(HAVE_GETOPT_H)!g" \
f915f0f7
EZ
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