Fix the MS-Windows build broken by 2011-01-17T19:01:01Z!eggert@cs.ucla.edu and emacs...
[emacs.git] / lib-src / makefile.w32-in
blob3685d0e71be58c3a1643c1dde8d6d8f503ed77aa
1 #  -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 # Copyright (C) 2000-2011 Free Software Foundation, Inc.
4 # This file is part of GNU Emacs.
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.
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.
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/>.
20 ALL = make-docfile hexl ctags etags movemail ebrowse emacsclient
22 .PHONY: $(ALL)
24 VERSION         = 24.0.50
26 LOCAL_FLAGS     = -DWINDOWSNT -DDOS_NT -DSTDC_HEADERS=1 -DNO_LDAV=1 \
27                   -DNO_ARCHIVES=1 -DHAVE_CONFIG_H=1 -I../lib \
28                   -I../nt/inc -I../src
30 LIBS            = $(BASE_LIBS) $(ADVAPI32)
32 $(BLD)/make-docfile.exe:        $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O)
33                 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/make-docfile.$(O) $(BLD)/ntlib.$(O) $(LIBS)
34 $(BLD)/hexl.exe:                $(BLD)/hexl.$(O)
35                 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/hexl.$(O) $(LIBS)
36 $(BLD)/fakemail.exe:            $(BLD)/fakemail.$(O) $(BLD)/ntlib.$(O)
37                 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/fakemail.$(O) $(BLD)/ntlib.$(O) $(LIBS)
38 $(BLD)/test-distrib.exe: $(BLD)/test-distrib.$(O)
39                 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(BLD)/test-distrib.$(O) $(LIBS)
41 make-docfile:   stamp_BLD $(BLD)/make-docfile.exe
42 ctags:          stamp_BLD $(BLD)/ctags.exe
43 etags:          stamp_BLD $(BLD)/etags.exe
44 ebrowse:        stamp_BLD $(BLD)/ebrowse.exe
45 hexl:           stamp_BLD $(BLD)/hexl.exe
46 movemail:       stamp_BLD $(BLD)/movemail.exe
47 fakemail:       stamp_BLD $(BLD)/fakemail.exe
48 emacsclient:    stamp_BLD $(BLD)/emacsclient.exe $(BLD)/emacsclientw.exe
50 test-distrib:   stamp_BLD $(BLD)/test-distrib.exe
51         "$(BLD)/test-distrib.exe" "$(SRC)/testfile"
53 MOVEMAILOBJS =  $(BLD)/movemail.$(O) \
54                 $(BLD)/pop.$(O) \
55                 ../lib/$(BLD)/libgnu.$(A) \
56                 $(BLD)/ntlib.$(O)
58 $(BLD)/movemail.exe:    $(MOVEMAILOBJS) ../lib/getopt.h
59 # put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib
60                 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(MOVEMAILOBJS) $(WSOCK32) $(LIBS)
62 ECLIENT_CFLAGS = -DHAVE_GETCWD -DHAVE_STRERROR -DVERSION="\"$(VERSION)\""
63 ECLIENTOBJS =   $(BLD)/emacsclient.$(O) \
64                 $(BLD)/ntlib.$(O) \
65                 ../lib/$(BLD)/libgnu.$(A)
66 CLIENTRES =     ../nt/$(BLD)/emacsclient.res
68 $(CLIENTRES):   ../nt/emacsclient.rc
69         @echo Emacsclient resource file must be built from nt directory
70         @exit -1
72 $(BLD)/emacsclient.exe:         $(ECLIENTOBJS)
73 # put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib
74                 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) $(USER32) $(COMCTL32) $(LIBS)
76 $(BLD)/emacsclientw.exe:        $(ECLIENTOBJS) $(CLIENTRES)
77 # put wsock32.lib before $(LIBS) to ensure we don't link to ws2_32.lib
78                 $(LINK) $(LINK_OUT)$@ $(CLIENTRES) -mwindows $(LINK_FLAGS) $(ECLIENTOBJS) $(WSOCK32) $(USER32) $(COMCTL32) $(LIBS)
80 # emacsclient.$(O) depends on makefile.w32-in because makefile.w32-in
81 # can be edited to define VERSION string, which is part of ECLIENT_CFLAGS.
82 $(BLD)/emacsclient.$(O):        emacsclient.c makefile.w32-in
83                 $(CC) $(CFLAGS) $(ECLIENT_CFLAGS) $(CC_OUT)$@ emacsclient.c
85 ETAGSOBJ      = $(BLD)/etags.$(O) \
86                 ../lib/$(BLD)/libgnu.$(A) \
87                 $(BLD)/ntlib.$(O) \
88                 $(BLD)/regex.$(O)
90 $(BLD)/etags.exe:       $(ETAGSOBJ)
91                 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(ETAGSOBJ) $(LIBS)
94 EBROWSEOBJ    = $(BLD)/ebrowse.$(O) \
95                 ../lib/$(BLD)/libgnu.$(A) \
96                 $(BLD)/ntlib.$(O)
98 $(BLD)/ebrowse.exe:     $(EBROWSEOBJ)
99                 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(EBROWSEOBJ) $(LIBS)
101 $(BLD)/regex.$(O): ../src/regex.c ../src/regex.h ../src/config.h
102                 $(CC)  $(CFLAGS) -DCONFIG_BROKETS -DINHIBIT_STRING_HEADER \
103                 ../src/regex.c $(CC_OUT)$@
105 ETAGS_CFLAGS  = -DHAVE_GETCWD
106 $(BLD)/etags.$(O): etags.c
107                 $(CC) $(CFLAGS) $(ETAGS_CFLAGS) $(CC_OUT)$@ etags.c
109 CTAGSOBJ      = $(BLD)/ctags.$(O) \
110                 ../lib/$(BLD)/libgnu.$(A) \
111                 $(BLD)/ntlib.$(O) \
112                 $(BLD)/regex.$(O)
114 $(BLD)/ctags.exe:  $(CTAGSOBJ)
115                 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $(CTAGSOBJ) $(LIBS)
117 ctags.c:        etags.c
118                 - $(DEL) ctags.c
119                 $(CP) etags.c ctags.c
121 CTAGS_CFLAGS  = -DCTAGS $(ETAGS_CFLAGS)
122 $(BLD)/ctags.$(O): ctags.c
123                 $(CC) $(CFLAGS) $(CTAGS_CFLAGS) $(CC_OUT)$@ ctags.c
126 # From ..\src\Makefile.in
127 # It doesn't matter if the real name is *.obj for the files in this list,
128 # make-docfile blindly replaces .o with .c anyway.  Keep .o in this list
129 # as it is required by code in doc.c.
131 obj =   dosfns.o msdos.o \
132         xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
133         fontset.o menu.o \
134         w32.o w32console.o w32fns.o w32heap.o w32inevt.o \
135         w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o \
136         font.o w32font.o w32uniscribe.o \
137         dispnew.o frame.o scroll.o xdisp.o window.o bidi.o \
138         charset.o coding.o category.o ccl.o character.o chartab.o \
139         cm.o term.o terminal.o xfaces.o \
140         emacs.o keyboard.o macros.o keymap.o sysdep.o \
141         buffer.o filelock.o insdel.o marker.o \
142         minibuf.o fileio.o dired.o filemode.o \
143         cmds.o casetab.o casefiddle.o indent.o search.o regex.o undo.o \
144         alloc.o data.o doc.o editfns.o callint.o \
145         eval.o floatfns.o fns.o print.o lread.o \
146         syntax.o bytecode.o \
147         process.o callproc.o unexw32.o \
148         region-cache.o sound.o atimer.o \
149         doprnt.o strftime.o intervals.o textprop.o composite.o md5.o
152 # These are the lisp files that are loaded up in loadup.el
154 lispsource = ../lisp/
156 MOUSE_SUPPORT = \
157         $(lispsource)select.elc \
158         $(lispsource)scroll-bar.elc \
159         $(lispsource)mouse.elc
160 WINNT_SUPPORT = \
161         $(lispsource)ls-lisp.elc \
162         $(lispsource)disp-table.elc \
163         $(lispsource)w32-fns.elc \
164         $(lispsource)dos-w32.elc \
165         $(lispsource)w32-vars.elc \
166         $(lispsource)term/common-win.elc \
167         $(lispsource)term/w32-win.elc
168 TOOLTIP_SUPPORT = $(lispsource)tooltip.elc
169 WINDOW_SUPPORT = \
170         $(lispsource)fringe.elc \
171         $(lispsource)image.elc \
172         $(lispsource)international/fontset.elc \
173         $(lispsource)dnd.elc \
174         $(lispsource)tool-bar.elc \
175         $(lispsource)mwheel.elc
177 # lisp files that are loaded up on other platforms
178 OTHER_PLATFORM_SUPPORT = \
179         $(lispsource)dos-fns.elc \
180         $(lispsource)dos-vars.elc \
181         $(lispsource)term/internal.elc \
182         $(lispsource)term/pc-win.elc \
183         $(lispsource)x-dnd.elc \
184         $(lispsource)term/x-win.elc \
185         $(lispsource)term/ns-win.elc
188 lisp1= \
189         $(lispsource)abbrev.elc \
190         $(lispsource)buff-menu.elc \
191         $(lispsource)button.elc \
192         $(lispsource)emacs-lisp/byte-run.elc \
193         $(lispsource)composite.elc \
194         $(lispsource)cus-face.elc \
195         $(lispsource)cus-start.elc \
196         $(lispsource)custom.elc \
197         $(lispsource)emacs-lisp/backquote.elc \
198         $(lispsource)emacs-lisp/lisp-mode.elc \
199         $(lispsource)emacs-lisp/lisp.elc \
200         $(lispsource)env.elc \
201         $(lispsource)faces.elc \
202         $(lispsource)files.elc \
203         $(lispsource)format.elc \
204         $(lispsource)facemenu.elc \
205         $(MOUSE_SUPPORT) \
206         $(lispsource)emacs-lisp/float-sup.elc \
207         $(lispsource)frame.elc \
208         $(lispsource)help.elc \
209         $(lispsource)indent.elc \
210         $(lispsource)isearch.elc \
211         $(lispsource)rfn-eshadow.elc \
212         $(lispsource)loadup.el \
213         $(lispsource)loaddefs.el \
214         $(lispsource)bindings.elc \
215         $(lispsource)emacs-lisp/map-ynp.elc \
216         $(lispsource)menu-bar.elc \
217         $(lispsource)international/mule.elc \
218         $(lispsource)international/mule-conf.el \
219         $(lispsource)international/mule-cmds.elc \
220         $(lispsource)international/characters.elc \
221         $(lispsource)international/charprop.el \
222         $(lispsource)case-table.elc
224 lisp2 = \
225         $(lispsource)language/chinese.el \
226         $(lispsource)language/cyrillic.el \
227         $(lispsource)language/indian.el \
228         $(lispsource)language/sinhala.el \
229         $(lispsource)language/english.el \
230         $(lispsource)language/ethiopic.elc \
231         $(lispsource)language/european.elc \
232         $(lispsource)language/czech.el \
233         $(lispsource)language/slovak.el \
234         $(lispsource)language/romanian.el \
235         $(lispsource)language/greek.el \
236         $(lispsource)language/hebrew.elc \
237         $(lispsource)language/japanese.el \
238         $(lispsource)language/korean.el \
239         $(lispsource)language/lao.el \
240         $(lispsource)language/cham.el \
241         $(lispsource)language/tai-viet.el \
242         $(lispsource)language/thai.el \
243         $(lispsource)language/tibetan.elc \
244         $(lispsource)language/vietnamese.el \
245         $(lispsource)language/misc-lang.el \
246         $(lispsource)language/utf-8-lang.el \
247         $(lispsource)language/georgian.el \
248         $(lispsource)language/khmer.el \
249         $(lispsource)language/burmese.el \
250         $(lispsource)paths.el \
251         $(lispsource)register.elc \
252         $(lispsource)replace.elc \
253         $(lispsource)simple.elc \
254         $(lispsource)minibuffer.elc \
255         $(lispsource)startup.elc \
256         $(lispsource)subr.elc \
257         $(lispsource)term/tty-colors.elc \
258         $(lispsource)font-core.elc \
259         $(lispsource)emacs-lisp/syntax.elc \
260         $(lispsource)font-lock.elc \
261         $(lispsource)jit-lock.elc \
262         $(lispsource)textmodes/fill.elc \
263         $(lispsource)textmodes/page.elc \
264         $(lispsource)textmodes/paragraphs.elc \
265         $(lispsource)textmodes/text-mode.elc \
266         $(lispsource)emacs-lisp/timer.elc \
267         $(lispsource)jka-cmpr-hook.elc \
268         $(lispsource)vc/vc-hooks.elc \
269         $(lispsource)vc/ediff-hook.elc \
270         $(lispsource)epa-hook.elc \
271         $(TOOLTIP_SUPPORT) \
272         $(WINNT_SUPPORT) \
273         $(WINDOW_SUPPORT) \
274         $(lispsource)widget.elc \
275         $(lispsource)window.elc \
276         $(lispsource)version.el
278 # Used by batch-update-autoloads.
279 echolisp:
280         @echo $(lisp1)
281         @echo $(lisp2)
283 # This is needed the first time we build the tree, since temacs.exe
284 # does not exist yet, and the DOC rule needs it to rebuild DOC whenever
285 # Emacs is rebuilt.
286 ../src/$(BLD)/temacs.exe:
287         - mkdir "../src/$(OBJDIR)"
288         - mkdir "../src/$(BLD)"
289         @echo temacs > temacs.exe
290         $(CP) temacs.exe ../src/$(BLD)
291         - $(DEL) temacs.exe
293 DOC           = DOC
294 $(DOC):         stamp_BLD $(BLD)/make-docfile.exe ../src/$(BLD)/temacs.exe $(lisp1) $(lisp2) $(OTHER_PLATFORM_SUPPORT)
295                 - $(DEL) $(DOC)
296                 "$(THISDIR)/$(BLD)/make-docfile" -o $(DOC) -d ../src $(obj)
297                 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(lisp1)
298                 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(lisp2)
299                 "$(THISDIR)/$(BLD)/make-docfile" -a $(DOC) -d ../src $(OTHER_PLATFORM_SUPPORT)
300                 $(CP) $(DOC) ../etc/DOC-X
301                 - mkdir "../src/$(OBJDIR)"
302                 - mkdir "../src/$(OBJDIR)/etc"
303                 $(CP) $(DOC) ../src/$(OBJDIR)/etc/DOC-X
305 {$(BLD)}.$(O){$(BLD)}.exe:
306                 $(LINK) $(LINK_OUT)$@ $(LINK_FLAGS) $*.$(O) $(LIBS)
309 # Build the executables
311 all:            stamp_BLD $(ALL) $(DOC)
314 # Assuming INSTALL_DIR is defined, build and install emacs in it.
316 INSTALL_FILES = $(ALL)
317 install:        $(INSTALL_FILES)
318                 - mkdir "$(INSTALL_DIR)/bin"
319                 $(CP) $(BLD)/etags.exe $(INSTALL_DIR)/bin
320                 $(CP) $(BLD)/ebrowse.exe $(INSTALL_DIR)/bin
321                 $(CP) $(BLD)/ctags.exe $(INSTALL_DIR)/bin
322                 $(CP) $(BLD)/hexl.exe $(INSTALL_DIR)/bin
323                 $(CP) $(BLD)/movemail.exe $(INSTALL_DIR)/bin
324                 $(CP) $(BLD)/emacsclient.exe $(INSTALL_DIR)/bin
325                 $(CP) $(BLD)/emacsclientw.exe $(INSTALL_DIR)/bin
326                 - mkdir "$(INSTALL_DIR)/etc"
327                 $(CP) $(DOC) $(INSTALL_DIR)/etc
330 # Maintenance
332 # We used to delete *~ here, but that might inadvertently remove
333 # precious files if it happens to match their short 8+3 aliases.
334 clean:
335                 - $(DEL) DOC* $(COMPILER_TEMP_FILES)
336                 - $(DEL) ctags.c
337                 - $(DEL_TREE) $(OBJDIR)
338                 - $(DEL) stamp_BLD
339                 - $(DEL) echolisp.tmp
341 distclean: cleanall
342         - $(DEL) TAGS
343         - $(DEL) Makefile
345 maintainer-clean: distclean
347 cleanall:       clean
348                 - $(DEL_TREE) obj
349                 - $(DEL_TREE) obj-spd
350                 - $(DEL_TREE) oo
351                 - $(DEL_TREE) oo-spd
354 # Headers we would preprocess if we could.
356 ../src/config.h:        ../nt/$(CONFIG_H)
357                         $(DEL) $@
358                         echo $(CONFIG_H) has changed.  Re-run configure.bat.
359                         exit -1
361 ### TAGS ###
363 TAGS: $(BLD)/etags.exe *.c *.h
364         $(BLD)/etags.exe *.c *.h
366 ### DEPENDENCIES ###
368 EMACS_ROOT      = ..
369 SRC             = .
371 $(BLD)/alloca.$(O) : \
372         $(SRC)/alloca.c \
373         $(EMACS_ROOT)/src/s/ms-w32.h \
374         $(EMACS_ROOT)/src/m/intel386.h \
375         $(EMACS_ROOT)/src/config.h \
376         $(EMACS_ROOT)/src/blockinput.h
378 $(BLD)/ctags.$(O) : \
379         $(SRC)/ctags.c \
380         $(EMACS_ROOT)/nt/inc/sys/param.h \
381         $(EMACS_ROOT)/src/s/ms-w32.h \
382         $(EMACS_ROOT)/src/m/intel386.h \
383         $(EMACS_ROOT)/lib-src/../src/config.h \
384         $(SRC)/ntlib.h \
385         $(EMACS_ROOT)/lib/getopt.h
387 $(BLD)/emacsclient.$(O) : \
388         $(SRC)/emacsclient.c \
389         $(EMACS_ROOT)/src/s/ms-w32.h \
390         $(EMACS_ROOT)/src/m/intel386.h \
391         $(EMACS_ROOT)/lib-src/../src/config.h
393 $(BLD)/etags.$(O) : \
394         $(SRC)/etags.c \
395         $(EMACS_ROOT)/nt/inc/sys/param.h \
396         $(EMACS_ROOT)/src/s/ms-w32.h \
397         $(EMACS_ROOT)/src/m/intel386.h \
398         $(EMACS_ROOT)/lib-src/../src/config.h \
399         $(SRC)/ntlib.h \
400         $(EMACS_ROOT)/lib/getopt.h
402 $(BLD)/fakemail.$(O) : \
403         $(SRC)/fakemail.c \
404         $(SRC)/ntlib.h \
405         $(EMACS_ROOT)/src/s/ms-w32.h \
406         $(EMACS_ROOT)/src/m/intel386.h \
407         $(EMACS_ROOT)/lib-src/../src/config.h \
408         $(EMACS_ROOT)/nt/inc/pwd.h
410 $(BLD)/getdate.$(O) : \
411         $(SRC)/getdate.c \
412         $(EMACS_ROOT)/src/s/ms-w32.h \
413         $(EMACS_ROOT)/src/m/intel386.h \
414         $(EMACS_ROOT)/src/config.h \
415         $(MSTOOLS_SYS)/types.h
417 $(BLD)/hexl.$(O) : \
418         $(SRC)/hexl.c
420 $(BLD)/leditcfns.$(O) : \
421         $(SRC)/leditcfns.c
423 $(BLD)/make-docfile.$(O) : \
424         $(SRC)/make-docfile.c \
425         $(EMACS_ROOT)/src/config.h
427 $(BLD)/make-path.$(O) : \
428         $(SRC)/make-path.c
430 $(BLD)/movemail.$(O) : \
431         $(SRC)/movemail.c \
432         $(EMACS_ROOT)/src/s/ms-w32.h \
433         $(EMACS_ROOT)/src/m/intel386.h \
434         $(EMACS_ROOT)/lib-src/../src/config.h \
435         $(EMACS_ROOT)/nt/inc/sys/file.h \
436         $(EMACS_ROOT)/lib-src/../src/syswait.h \
437         $(EMACS_ROOT)/nt/inc/pwd.h \
438         $(SRC)/ntlib.h
439         $(CC) $(CFLAGS) -DUSG $(CC_OUT)$@ movemail.c
441 $(BLD)/ntlib.$(O) : \
442         $(SRC)/ntlib.c \
443         $(SRC)/ntlib.h \
444         $(EMACS_ROOT)/nt/inc/pwd.h
446 $(BLD)/pop.$(O) : \
447         $(SRC)/pop.c \
448         $(SRC)/pop.h \
449         $(SRC)/ntlib.h
451 $(BLD)/profile.$(O) : \
452         $(SRC)/profile.c \
453         $(EMACS_ROOT)/src/s/ms-w32.h \
454         $(EMACS_ROOT)/src/m/intel386.h \
455         $(EMACS_ROOT)/lib-src/../src/config.h \
456         $(EMACS_ROOT)/lib-src/../src/systime.h
458 $(BLD)/qsort.$(O) : \
459         $(SRC)/qsort.c
461 $(BLD)/tcp.$(O) : \
462         $(SRC)/tcp.c
464 $(BLD)/test-distrib.$(O) : \
465         $(SRC)/test-distrib.c
467 $(BLD)/timer.$(O) : \
468         $(SRC)/timer.c \
469         $(EMACS_ROOT)/src/s/ms-w32.h \
470         $(EMACS_ROOT)/src/m/intel386.h \
471         $(EMACS_ROOT)/lib-src/../src/config.h
473 # The following dependencies are for supporting parallel builds, where
474 # we must make sure $(BLD) exists before any compilation starts.
476 $(BLD)/make-docfile.$(O) $(BLD)/hexl.$(O) $(BLD)/fakemail.$(O): stamp_BLD
478 $(BLD)/test-distrib.$(O) $(MOVEMAILOBJS): stamp_BLD
480 $(BLD)/emacsclient.$(O) $(BLD)/etags.$(O) $(BLD)/regex.$(O): stamp_BLD
482 $(BLD)/ebrowse.$(O) $(BLD)/ctags.$(O): stamp_BLD