makefile.w32-in 6.38 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
# -*- Makefile -*- for GNU Emacs on the Microsoft W32 API.
# Copyright (C) 2011 Free Software Foundation, Inc.

# This file is part of GNU Emacs.

# GNU Emacs is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# GNU Emacs is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.

ALL = gnulib

.PHONY: $(ALL)

23
LOCAL_FLAGS	= -I. -I../nt/inc -I../src
24 25
LIBS 		=

26 27 28 29
GNULIBOBJS = $(BLD)/c-ctype.$(O) \
	     $(BLD)/c-strcasecmp.$(O) \
	     $(BLD)/c-strncasecmp.$(O) \
	     $(BLD)/dtoastr.$(O) \
30
	     $(BLD)/dtotimespec.$(O)  \
31 32
	     $(BLD)/getopt.$(O)  \
	     $(BLD)/getopt1.$(O) \
33
	     $(BLD)/gettime.$(O) \
34
	     $(BLD)/strftime.$(O) \
35
	     $(BLD)/time_r.$(O) \
36 37
	     $(BLD)/timespec-add.$(O) \
	     $(BLD)/timespec-sub.$(O) \
38
	     $(BLD)/md5.$(O) \
Leo Liu's avatar
Leo Liu committed
39
	     $(BLD)/sha1.$(O) \
40 41
	     $(BLD)/sha256.$(O) \
	     $(BLD)/sha512.$(O) \
42
	     $(BLD)/filemode.$(O)
43 44 45 46 47 48 49 50

#
# Build the library
#
$(BLD)/libgnu.$(A):	$(GNULIBOBJS)
	- $(DEL) $@
	$(AR) $(AR_OUT)$@ $(ALL_DEPS)

51
gnulib:		$(BLD)/libgnu.$(A)
52 53 54 55

#
# Build everything
#
56
all:		$(ALL)
57 58 59

### TAGS ###

60 61 62
FRC:

TAGS: FRC
63 64 65 66 67
	 ../lib-src/$(BLD)/etags.exe *.c *.h

### DEPENDENCIES ###

EMACS_ROOT	= ..
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
GNU_LIB		= .
SRC		= $(EMACS_ROOT)/src
NT_INC		= $(EMACS_ROOT)/nt/inc

C_CTYPE_H      = $(GNU_LIB)/c-ctype.h \
		 $(NT_INC)/stdbool.h
MS_W32_H       = $(SRC)/s/ms-w32.h \
		 $(NT_INC)/sys/stat.h
CONFIG_H       = $(SRC)/config.h \
		 $(MS_W32_H)
FILEMODE_H     = $(GNU_LIB)/filemode.h \
		 $(NT_INC)/sys/stat.h
FTOASTR_H      = $(GNU_LIB)/ftoastr.h \
		 $(GNU_LIB)/intprops.h
FTOASTR_C      = $(GNU_LIB)/ftoastr.c \
		 $(CONFIG_H) \
		 $(FTOASTR_H) \
		 $(GNU_LIB)/ftoastr.h
GETOPT_INT_H   = $(GNU_LIB)/getopt_int.h \
		 $(GNU_LIB)/getopt.h
MD5_H          = $(GNU_LIB)/md5.h \
		 $(NT_INC)/stdint.h
SHA1_H         = $(GNU_LIB)/sha1.h \
		 $(NT_INC)/stdint.h
SHA256_H       = $(GNU_LIB)/sha256.h \
		 $(NT_INC)/stdint.h
U64_H          = $(GNU_LIB)/u64.h \
		 $(NT_INC)/stdint.h
SHA512_H       = $(GNU_LIB)/sha512.h \
		 $(U64_H) \
		 $(GNU_LIB)/u64.h
99

100
$(BLD)/c-ctype.$(O) : \
101 102 103
	$(GNU_LIB)/c-ctype.c \
	$(CONFIG_H) \
	$(C_CTYPE_H)
104 105

$(BLD)/c-strcasecmp.$(O) : \
106 107 108 109
	$(GNU_LIB)/c-strcasecmp.c \
	$(GNU_LIB)/c-strcase.h \
	$(CONFIG_H) \
	$(C_CTYPE_H)
110 111

$(BLD)/c-strncasecmp.$(O) : \
112 113 114 115
	$(GNU_LIB)/c-strncasecmp.c \
	$(GNU_LIB)/c-strcase.h \
	$(CONFIG_H) \
	$(C_CTYPE_H)
116

117
$(BLD)/dtoastr.$(O) : \
118 119
	$(GNU_LIB)/dtoastr.c \
	$(FTOASTR_C)
120

121
$(BLD)/dtotimespec.$(O) : \
122 123 124 125
	$(GNU_LIB)/dtotimespec.c \
	$(GNU_LIB)/intprops.h \
	$(GNU_LIB)/timespec.h \
	$(CONFIG_H)
126

127
$(BLD)/getopt.$(O) : \
128 129 130 131 132 133
	$(GNU_LIB)/getopt.c \
	$(GNU_LIB)/getopt.h \
	$(GNU_LIB)/gettext.h \
	$(NT_INC)/unistd.h \
	$(CONFIG_H) \
	$(GETOPT_INT_H)
134 135

$(BLD)/getopt1.$(O) : \
136 137 138 139
	$(GNU_LIB)/getopt1.c \
	$(GNU_LIB)/getopt.h \
	$(CONFIG_H) \
	$(GETOPT_INT_H)
140

141
$(BLD)/gettime.$(O) : \
142 143 144 145
	$(GNU_LIB)/gettime.c \
	$(GNU_LIB)/timespec.h \
	$(NT_INC)/sys/time.h \
	$(CONFIG_H)
146

147
$(BLD)/strftime.$(O) : \
148 149 150 151
	$(GNU_LIB)/strftime.c \
	$(GNU_LIB)/strftime.h \
	$(NT_INC)/stdbool.h \
	$(CONFIG_H)
152 153

$(BLD)/time_r.$(O) : \
154 155
	$(GNU_LIB)/time_r.c \
	$(CONFIG_H)
156

157
$(BLD)/timespec-add.$(O) : \
158 159 160 161
	$(GNU_LIB)/timespec-add.c \
	$(GNU_LIB)/intprops.h \
	$(GNU_LIB)/timespec.h \
	$(CONFIG_H)
162 163

$(BLD)/timespec-sub.$(O) : \
164 165 166 167
	$(GNU_LIB)/timespec-sub.c \
	$(GNU_LIB)/intprops.h \
	$(GNU_LIB)/timespec.h \
	$(CONFIG_H)
168

169
$(BLD)/md5.$(O) : \
170 171 172 173 174
	$(GNU_LIB)/md5.c \
	$(NT_INC)/stdalign.h \
	$(NT_INC)/stdint.h \
	$(CONFIG_H) \
	$(MD5_H)
175

Leo Liu's avatar
Leo Liu committed
176
$(BLD)/sha1.$(O) : \
177 178 179 180 181
	$(GNU_LIB)/sha1.c \
	$(NT_INC)/stdalign.h \
	$(NT_INC)/stdint.h \
	$(CONFIG_H) \
	$(SHA1_H)
Leo Liu's avatar
Leo Liu committed
182

183
$(BLD)/sha256.$(O) : \
184 185 186 187 188
	$(GNU_LIB)/sha256.c \
	$(NT_INC)/stdalign.h \
	$(NT_INC)/stdint.h \
	$(CONFIG_H) \
	$(SHA256_H)
189 190

$(BLD)/sha512.$(O) : \
191 192 193 194 195
	$(GNU_LIB)/sha512.c \
	$(NT_INC)/stdalign.h \
	$(NT_INC)/stdint.h \
	$(CONFIG_H) \
	$(SHA512_H)
196

197
$(BLD)/filemode.$(O) : \
198 199 200
	$(GNU_LIB)/filemode.c \
	$(CONFIG_H) \
	$(FILEMODE_H)
201

202 203 204
# The following dependencies are for supporting parallel builds, where
# we must make sure $(BLD) exists before any compilation starts.
#
205
$(GNULIBOBJS): stamp_BLD
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263

#
# Headers we would preprocess if we could.
#
getopt.h:	getopt_.h
	$(CP) $(ALL_DEPS) $@

#
# Maintenance
#
clean:
	- $(DEL) $(COMPILER_TEMP_FILES)
	- $(DEL) getopt.h
	- $(DEL_TREE) $(OBJDIR)
	- $(DEL) stamp_BLD

distclean:	cleanall
	- $(DEL) TAGS
	- $(DEL) Makefile

maintainer-clean: distclean
	- $(DEL) getopt_.h

cleanall:	clean
	- $(DEL_TREE) obj
	- $(DEL_TREE) obj-spd
	- $(DEL_TREE) oo
	- $(DEL_TREE) oo-spd

# A dummy target to force other targets to be evaluated.
doit:

getopt_.h: getopt.in.h $(ARG_NONNULL_H)
	$(MAKE) $(MFLAGS) getopt_.h-$(SHELLTYPE)

getopt_.h-CMD: doit
	@echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
	@echo Run "$(MAKETYPE) getopt_h" in the lib/ subdirectory.
	@echo You will need GNU Sed to be installed.
	exit -1

getopt_.h-SH: doit
	@echo getopt.in.h or $(ARG_NONNULL_H) is newer than getopt_.h.
	@echo Run '"$(MAKETYPE) getopt_h"' in the lib/ subdirectory.
	@echo You will need GNU Sed to be installed.
	exit -1

# Generating getopt_.h from getopt.in.h.
#
# To avoid requiring all end users to install Sed, we have below
# a maintainer-only target that produces getopt_.h from getopt.in.h.
# For easier maintenance, all the strings that replace the @FOO@
# placeholder are defined as Make macros below.

HAVE_GETOPT_H = HAVE_GETOPT_H
INCLUDE_NEXT = include_next
PRAGMA_COLUMNS =
NEXT_GETOPT_H = <getopt.h>
264
ARG_NONNULL_H = ../build-aux/snippet/arg-nonnull.h
265 266 267

getopt_h:
	- $(DEL) getopt_.h-t getopt_.h
268 269
	sed -e "s!@GUARD_PREFIX@!GL!g" \
	    -e "s!@HAVE_GETOPT_H@!$(HAVE_GETOPT_H)!g" \
270 271 272 273 274 275 276 277 278 279 280 281
	    -e "s!@INCLUDE_NEXT@!$(INCLUDE_NEXT)!g" \
	    -e "s!@PRAGMA_SYSTEM_HEADER@!$(PRAGMA_SYSTEM_HEADER)!g" \
	    -e "s!@PRAGMA_COLUMNS@!$(PRAGMA_COLUMNS)!g" \
	    -e "s!@NEXT_GETOPT_H@!$(NEXT_GETOPT_H)!g" \
	    -e "/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)" \
	    -e "/^\# include_next/i # ifndef __GNUC__" \
	    -e "/^\# include_next/i # include <next_getopt.h>" \
	    -e "/^\# include_next/i # else" \
	    -e "/^\# include_next/a # endif" \
	      < getopt.in.h > getopt_.h-t
	$(CP) getopt_.h-t getopt_.h
	- $(DEL) getopt_.h-t