2000-02-18 03:38:33 +08:00
|
|
|
# Makefile.common - common definitions for the winsup directory
|
|
|
|
#
|
2012-07-30 12:43:22 +08:00
|
|
|
# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2009, 2012 Red Hat, Inc.
|
2000-02-18 03:38:33 +08:00
|
|
|
#
|
|
|
|
# This file is part of Cygwin.
|
|
|
|
#
|
|
|
|
# This software is a copyrighted work licensed under the terms of the
|
|
|
|
# Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
# details.
|
|
|
|
|
|
|
|
# This makefile requires GNU make.
|
|
|
|
|
2012-07-30 12:43:22 +08:00
|
|
|
CFLAGS_COMMON:=-Wall -Wstrict-aliasing -Wwrite-strings -fno-common -pipe -fbuiltin -fmessage-length=0 -D_SDKDDKVER_H
|
2000-10-23 06:43:47 +08:00
|
|
|
MALLOC_DEBUG:=#-DMALLOC_DEBUG -I/cygnus/src/uberbaum/winsup/cygwin/dlmalloc
|
|
|
|
MALLOC_OBJ:=#/cygnus/src/uberbaum/winsup/cygwin/dlmalloc/malloc.o
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2000-04-18 08:37:04 +08:00
|
|
|
override srcdir:=${shell cd $(srcdir); pwd}
|
2000-04-10 11:51:39 +08:00
|
|
|
ifneq (,${filter-out /%,$(srcdir)})
|
2000-02-18 03:38:33 +08:00
|
|
|
updir:=$(srcdir)/..
|
|
|
|
updir1:=$(updir)/..
|
|
|
|
else
|
|
|
|
updir:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(srcdir)):::}}
|
|
|
|
ifneq (,${findstring /,$(updir)})
|
|
|
|
updir1:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(updir)):::}}
|
|
|
|
else
|
|
|
|
updir1:=$(updir)/..
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
pwd:=${shell pwd}
|
2001-05-15 13:11:55 +08:00
|
|
|
ifneq "${filter winsup%,${notdir $(pwd)}}" ""
|
|
|
|
here:=${pwd}/cygwin
|
|
|
|
else
|
|
|
|
here:=${dir $(pwd)}cygwin
|
|
|
|
endif
|
2000-09-01 22:20:30 +08:00
|
|
|
bupdir:=${shell cd $(here)/..; pwd}
|
|
|
|
ifneq (,${filter-out /%,$(bupdir)})
|
2000-02-18 03:38:33 +08:00
|
|
|
bupdir1:=../..
|
2000-08-25 03:05:38 +08:00
|
|
|
bupdir2:=../../..
|
2000-02-18 03:38:33 +08:00
|
|
|
else
|
|
|
|
ifneq (,${findstring /,$(bupdir)})
|
|
|
|
bupdir1:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(bupdir)):::}}
|
|
|
|
else
|
|
|
|
bupdir1:=$(bupdir)/..
|
|
|
|
endif
|
2000-08-25 03:05:38 +08:00
|
|
|
ifneq (,${findstring /,$(bupdir1)})
|
|
|
|
bupdir2:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(bupdir1)):::}}
|
|
|
|
else
|
|
|
|
bupdir2:=$(bupdir1)/..
|
|
|
|
endif
|
2000-02-18 03:38:33 +08:00
|
|
|
endif
|
|
|
|
|
2001-12-15 02:23:19 +08:00
|
|
|
zlib_source:=$(updir)/zlib
|
|
|
|
zlib_build:=$(bupdir)/zlib
|
|
|
|
bz2lib_source:=$(updir)/bz2lib
|
|
|
|
bz2lib_build:=$(bupdir)/bz2lib
|
2000-02-18 03:38:33 +08:00
|
|
|
w32api_source:=$(updir)/w32api
|
|
|
|
w32api_build:=$(bupdir)/w32api
|
|
|
|
w32api_lib:=$(w32api_build)/lib
|
|
|
|
newlib_source:=$(updir1)/newlib
|
|
|
|
newlib_build:=$(bupdir1)/newlib
|
|
|
|
cygwin_build:=$(bupdir)/cygwin
|
|
|
|
cygwin_source:=$(updir)/cygwin
|
|
|
|
mingw_build:=$(bupdir)/mingw
|
|
|
|
mingw_source:=$(updir)/mingw
|
|
|
|
utils_build:=$(bupdir)/utils
|
|
|
|
utils_source:=$(updir)/utils
|
2001-10-12 20:52:05 +08:00
|
|
|
ifeq (,${findstring $(newlib_source)/libc/include,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
|
2001-10-10 09:57:43 +08:00
|
|
|
newlib_include:=-I$(newlib_source)/libc/include
|
2001-10-12 20:52:05 +08:00
|
|
|
endif
|
2001-10-10 09:57:43 +08:00
|
|
|
ifeq (,${findstring $(cygwin_source)/include,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
|
|
|
|
cygwin_include:=-I$(cygwin_source)/include
|
|
|
|
endif
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2003-08-06 10:06:43 +08:00
|
|
|
nostdincxx:=-nostdinc++
|
2003-04-19 09:02:51 +08:00
|
|
|
|
|
|
|
nostdlib:=-nostdlib
|
|
|
|
|
|
|
|
ifeq (,${nostdlib})
|
|
|
|
nostdinc:=
|
|
|
|
endif
|
|
|
|
|
2012-10-24 18:11:15 +08:00
|
|
|
INCLUDES:=-I. $(cygwin_include) -I$(cygwin_source) $(newlib_include)
|
2000-02-18 03:38:33 +08:00
|
|
|
ifdef CONFIG_DIR
|
|
|
|
INCLUDES+=-I$(CONFIG_DIR)
|
|
|
|
endif
|
|
|
|
|
2012-10-24 18:11:15 +08:00
|
|
|
MINGW_LDFLAGS:=-static
|
|
|
|
MINGW_CFLAGS:=
|
|
|
|
MINGW_CXXFLAGS:=
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
GCC_DEFAULT_OPTIONS:=$(CFLAGS_COMMON) $(CFLAGS_CONFIG) $(INCLUDES)
|
|
|
|
|
|
|
|
# Link in libc and libm from newlib
|
|
|
|
|
|
|
|
LIBC:=$(newlib_build)/libc/libc.a
|
|
|
|
LIBM:=$(newlib_build)/libm/libm.a
|
2003-05-12 19:06:00 +08:00
|
|
|
CRT0:=$(cygwin_build)/crt0.o
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2012-07-06 18:32:11 +08:00
|
|
|
ALL_CFLAGS=$(DEFS) $(MALLOC_DEBUG) $(CFLAGS) $(GCC_DEFAULT_OPTIONS)
|
2003-03-29 12:15:52 +08:00
|
|
|
ALL_CXXFLAGS=$(DEFS) $(MALLOC_DEBUG) $(CXXFLAGS) $(GCC_DEFAULT_OPTIONS)
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
ifndef PREPROCESS
|
|
|
|
c=-c
|
|
|
|
o=.o
|
|
|
|
else
|
2005-03-23 11:22:27 +08:00
|
|
|
c=-E -dD
|
2000-02-18 03:38:33 +08:00
|
|
|
o=.E
|
|
|
|
endif
|
|
|
|
|
2000-12-03 13:40:45 +08:00
|
|
|
libgcc:=${subst \,/,${shell $(CC_FOR_TARGET) -print-libgcc-file-name}}
|
2001-10-10 09:57:43 +08:00
|
|
|
gcc_libdir:=${word 1,${dir $(libgcc)}}
|
|
|
|
ifeq (,${findstring $(gcc_libdir),$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
|
2003-03-10 03:22:15 +08:00
|
|
|
GCC_INCLUDE:=${subst //,/,-I$(gcc_libdir)/include}
|
2001-10-10 09:57:43 +08:00
|
|
|
endif
|
2000-02-18 03:38:33 +08:00
|
|
|
|
winsup/ChangeLog:
* Makefile.common (COMPILE_CXX): Add support for per-file overrides
to exclude $(nostdinc) and $(nostdincxx) from compiler flags.
(COMPILE_CC): Likewise for $(nostdinc).
winsup/cygwin/ChangeLog:
* Makefile.in (DLL_OFILES): Add libstdcxx_wrapper.o
(libstdcxx_wrapper_CFLAGS): Add flags for new module.
(_cygwin_crt0_common_STDINCFLAGS): Define per-file override.
(libstdcxx_wrapper_STDINCFLAGS, cxx_STDINCFLAGS): Likewise.
* cxx.cc: Include "cygwin-cxx.h".
(operator new): Tweak prototype for full standards compliance.
(operator new[]): Likewise.
(operator new (nothrow)): New fallback function.
(operator new[] (nothrow), operator delete (nothrow),
operator delete[] (nothrow)): Likewise.
(default_cygwin_cxx_malloc): New struct of pointers to the above,
for final last-resort fallback default.
* cygwin-cxx.h: New file.
(struct per_process_cxx_malloc): Define.
(default_cygwin_cxx_malloc): Declare extern.
* cygwin.din (__wrap__ZdaPv): Export new wrapper.
(__wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
__wrap__ZnwjRKSt9nothrow_t): Likewise.
* globals.cc (__cygwin_user_data): Init newly-repurposed 'forkee'
field (now 'cxx_malloc') to point to default_cygwin_cxx_malloc.
* libstdcxx_wrapper.cc: New file.
(__wrap__ZdaPv, __wrap__ZdaPvRKSt9nothrow_t, __wrap__ZdlPv,
__wrap__ZdlPvRKSt9nothrow_t, __wrap__Znaj,
__wrap__ZnajRKSt9nothrow_t, __wrap__Znwj,
__wrap__ZnwjRKSt9nothrow_t): Define wrapper functions for libstdc++
malloc operators and their overrides.
* winsup.h (default_cygwin_cxx_malloc): Declare extern.
* include/cygwin/version.h (CYGWIN_VERSION_API_MINOR): Bump.
* include/sys/cygwin.h (struct per_process_cxx_malloc): Forward
declare here.
(struct per_process::forkee): Rename and repurpose from this ...
(struct per_process::cxx_malloc): ... to this.
* lib/_cygwin_crt0_common.cc: Include cygwin-cxx.h.
(WEAK): Define shorthand helper macro.
(__cygwin_cxx_malloc): Define and populate with weak references
to whatever libstdc++ malloc operators will be visible at final
link time for Cygwin apps and dlls.
(_cygwin_crt0_common): Always look up cygwin DLL's internal
per_process data, and don't test for (impossible) failure. Inherit
any members of __cygwin_cxx_malloc that we don't have overrides
for from the DLL's default and store the resulting overall set of
overrides back into the DLL's global per_process data.
2009-07-08 04:12:44 +08:00
|
|
|
COMPILE_CXX=$(CXX) $c $(if $($(*F)_STDINCFLAGS),,$(nostdincxx) $(nostdinc)) \
|
|
|
|
$(ALL_CXXFLAGS) $(GCC_INCLUDE) -fno-rtti -fno-exceptions
|
|
|
|
COMPILE_CC=$(CC) $c $(if $($(*F)_STDINCFLAGS),,$(nostdinc)) $(ALL_CFLAGS) $(GCC_INCLUDE)
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2012-10-24 18:11:15 +08:00
|
|
|
vpath %.a $(cygwin_build):$(newlib_build)/libc:$(newlib_build)/libm
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2000-04-09 14:15:43 +08:00
|
|
|
MAKEOVERRIDES_WORKAROUND=${wordlist 2,1,a b c}
|
|
|
|
|
|
|
|
ifneq ($(MAKEOVERRIDES_WORKAROUND),)
|
|
|
|
override MAKE:=$(MAKE) $(MAKEOVERRIDES)
|
|
|
|
MAKEOVERRIDES:=
|
|
|
|
export MAKEOVERRIDES
|
|
|
|
endif
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2000-10-01 12:32:36 +08:00
|
|
|
ifdef RPATH_ENVVAR
|
|
|
|
VERBOSE=1
|
|
|
|
endif
|
|
|
|
|
2000-10-02 10:05:23 +08:00
|
|
|
ifneq "${findstring -B,$(COMPILE_CXX) $(COMPILE_CC)}" ""
|
|
|
|
VERBOSE=1
|
|
|
|
endif
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
.PRECIOUS: %.o
|
|
|
|
|
|
|
|
%.o: %.cc
|
|
|
|
ifdef VERBOSE
|
|
|
|
$(COMPILE_CXX) -o $(@D)/$(*F)$o $<
|
|
|
|
else
|
2000-12-03 13:40:45 +08:00
|
|
|
@echo $(CXX) $c $(CXXFLAGS) ... $(*F).cc
|
2000-05-25 02:54:10 +08:00
|
|
|
@$(COMPILE_CXX) -o $(@D)/$(*F)$o $<
|
2000-02-18 03:38:33 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
ifdef VERBOSE
|
|
|
|
$(COMPILE_CC) -o $(@D)/$(*F)$o $<
|
|
|
|
else
|
2000-05-25 02:54:10 +08:00
|
|
|
@echo $(CC) $c $(CFLAGS) ... $(*F).c
|
|
|
|
@$(COMPILE_CC) -o $(@D)/$(*F)$o $<
|
2000-02-18 03:38:33 +08:00
|
|
|
endif
|
|
|
|
|
|
|
|
$(bupdir1)/libiberty/%.o: $(updir1)/libiberty/%.c
|
2000-04-10 11:51:39 +08:00
|
|
|
@$(MAKE) -C $(@D) $(@F)
|
2000-02-18 03:38:33 +08:00
|
|
|
|
|
|
|
$(w32api_lib)/%.a: $(w32api_lib)/Makefile
|
2000-04-10 11:51:39 +08:00
|
|
|
@$(MAKE) --no-print-dir -C $(@D) $(@F)
|
2000-02-18 03:38:33 +08:00
|
|
|
|
2001-12-15 02:26:43 +08:00
|
|
|
$(bz2lib)/%.a: $(bz2lib)/Makefile
|
2001-12-15 02:23:19 +08:00
|
|
|
@$(MAKE) --no-print-dir -C $(@D) $(@F)
|
|
|
|
|
2001-12-15 02:26:43 +08:00
|
|
|
$(zlib)/%.a: $(zlib)/Makefile
|
2001-12-15 02:23:19 +08:00
|
|
|
@$(MAKE) --no-print-dir -C $(@D) $(@F)
|
|
|
|
|
2000-02-18 03:38:33 +08:00
|
|
|
all:
|
|
|
|
|
|
|
|
# For auto-rebuilding the Makefile
|
|
|
|
|
|
|
|
.PRECIOUS: Makefile
|
|
|
|
|
|
|
|
Makefile: Makefile.in $(srcdir)/configure.in config.status
|
|
|
|
$(SHELL) config.status
|
|
|
|
|
|
|
|
config.status: configure
|
|
|
|
$(SHELL) config.status --recheck
|