Fix the MS-Windows build broken by 2011-01-17T19:01:01Z!eggert@cs.ucla.edu and emacs...
[emacs.git] / lib / makefile.w32-in
blobcf74288e2cfd7d2c880ef241b78af121bbd1d09b
1 # -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
2 # Copyright (C) 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/>.
19 ALL = gnulib
21 .PHONY: $(ALL)
23 LOCAL_FLAGS     = -DHAVE_CONFIG_H=1 -I. -I../nt/inc -I../src
24 LIBS            =
26 GNULIBOBJS      = $(BLD)/dtoastr.$(O) $(BLD)/getopt.$(O) $(BLD)/getopt1.$(O)
29 # Build the library
31 $(BLD)/libgnu.$(A):     $(GNULIBOBJS)
32         - $(DEL) $@
33         $(AR) $(AR_OUT)$@ $(ALL_DEPS)
35 gnulib: stamp_BLD $(BLD)/libgnu.$(A)
38 # Build everything
40 all:            stamp_BLD $(ALL)
42 ### TAGS ###
44 TAGS:
45          ../lib-src/$(BLD)/etags.exe *.c *.h
47 ### DEPENDENCIES ###
49 EMACS_ROOT      = ..
50 SRC             = .
52 $(BLD)/dtoastr.$(O) : \
53         $(SRC)/dtoastr.c \
54         $(SRC)/ftoastr.c \
55         $(SRC)/ftoastr.h \
56         $(SRC)/intprops.h \
57         $(EMACS_ROOT)/src/config.h
59 $(BLD)/getopt.$(O) : \
60         $(SRC)/getopt.c \
61         $(SRC)/getopt.h \
62         $(SRC)/getopt_int.h \
63         $(EMACS_ROOT)/src/s/ms-w32.h \
64         $(EMACS_ROOT)/src/m/intel386.h \
65         $(EMACS_ROOT)/src/config.h
67 $(BLD)/getopt1.$(O) : \
68         $(SRC)/getopt1.c \
69         $(SRC)/getopt.h \
70         $(SRC)/getopt_int.h \
71         $(EMACS_ROOT)/src/s/ms-w32.h \
72         $(EMACS_ROOT)/src/m/intel386.h \
73         $(EMACS_ROOT)/src/config.h
75 # The following dependencies are for supporting parallel builds, where
76 # we must make sure $(BLD) exists before any compilation starts.
78 $(BLD)/dtoastr.$(O) $(BLD)/getopt.$(O) $(BLD)/getopt1.$(O): stamp_BLD
81 # Headers we would preprocess if we could.
83 getopt.h:       getopt_.h
84         $(CP) $(ALL_DEPS) $@
87 # Maintenance
89 clean:
90         - $(DEL) $(COMPILER_TEMP_FILES)
91         - $(DEL) getopt.h
92         - $(DEL_TREE) $(OBJDIR)
93         - $(DEL) stamp_BLD
95 distclean:      cleanall
96         - $(DEL) TAGS
97         - $(DEL) Makefile
99 maintainer-clean: distclean
100         - $(DEL) getopt_.h
102 cleanall:       clean
103         - $(DEL_TREE) obj
104         - $(DEL_TREE) obj-spd
105         - $(DEL_TREE) oo
106         - $(DEL_TREE) oo-spd
108 # A dummy target to force other targets to be evaluated.
109 doit:
111 getopt_.h: getopt.in.h $(ARG_NONNULL_H)
112         $(MAKE) $(MFLAGS) getopt_.h-$(SHELLTYPE)
114 getopt_.h-CMD: doit
115         @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
116         @echo Run "$(MAKETYPE) getopt_h" in the lib/ subdirectory.
117         @echo You will need GNU Sed to be installed.
118         exit -1
120 getopt_.h-SH: doit
121         @echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
122         @echo Run '"$(MAKETYPE) getopt_h"' in the lib/ subdirectory.
123         @echo You will need GNU Sed to be installed.
124         exit -1
126 # Generating getopt_.h from getopt.in.h.
128 # To avoid requiring all end users to install Sed, we have below
129 # a maintainer-only target that produces getopt_.h from getopt.in.h.
130 # For easier maintenance, all the strings that replace the @FOO@
131 # placeholder are defined as Make macros below.
133 HAVE_GETOPT_H = HAVE_GETOPT_H
134 INCLUDE_NEXT = include_next
135 PRAGMA_SYSTEM_HEADER = \#pragma GCC system_header
136 PRAGMA_COLUMNS =
137 NEXT_GETOPT_H = <getopt.h>
138 ARG_NONNULL_H = ../arg-nonnull.h
140 getopt_h:
141         - $(DEL) getopt_.h-t getopt_.h
142         sed -e "s!@HAVE_GETOPT_H@!$(HAVE_GETOPT_H)!g" \
143             -e "s!@INCLUDE_NEXT@!$(INCLUDE_NEXT)!g" \
144             -e "s!@PRAGMA_SYSTEM_HEADER@!$(PRAGMA_SYSTEM_HEADER)!g" \
145             -e "s!@PRAGMA_COLUMNS@!$(PRAGMA_COLUMNS)!g" \
146             -e "s!@NEXT_GETOPT_H@!$(NEXT_GETOPT_H)!g" \
147             -e "/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)" \
148             -e "/^\# include_next/i # ifndef __GNUC__" \
149             -e "/^\# include_next/i # include <next_getopt.h>" \
150             -e "/^\# include_next/i # else" \
151             -e "/^\# include_next/a # endif" \
152               < getopt.in.h > getopt_.h-t
153         $(CP) getopt_.h-t getopt_.h
154         - $(DEL) getopt_.h-t