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