]> sourceware.org Git - newlib-cygwin.git/blame - winsup/Makefile.common
2012-10-24 Kai Tietz <ktietz70@googlemail.com>
[newlib-cygwin.git] / winsup / Makefile.common
CommitLineData
1fd5e000
CF
1# Makefile.common - common definitions for the winsup directory
2#
7d8b0c84 3# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2009, 2012 Red Hat, Inc.
1fd5e000
CF
4#
5# This file is part of Cygwin.
6#
7# This software is a copyrighted work licensed under the terms of the
8# Cygwin license. Please consult the file "CYGWIN_LICENSE" for
9# details.
10
11# This makefile requires GNU make.
12
7d8b0c84 13CFLAGS_COMMON:=-Wall -Wstrict-aliasing -Wwrite-strings -fno-common -pipe -fbuiltin -fmessage-length=0 -D_SDKDDKVER_H
de7ba863
CF
14MALLOC_DEBUG:=#-DMALLOC_DEBUG -I/cygnus/src/uberbaum/winsup/cygwin/dlmalloc
15MALLOC_OBJ:=#/cygnus/src/uberbaum/winsup/cygwin/dlmalloc/malloc.o
1fd5e000 16
2cf2f098 17override srcdir:=${shell cd $(srcdir); pwd}
ba87a619 18ifneq (,${filter-out /%,$(srcdir)})
1fd5e000
CF
19 updir:=$(srcdir)/..
20 updir1:=$(updir)/..
21else
22 updir:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(srcdir)):::}}
23ifneq (,${findstring /,$(updir)})
24 updir1:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(updir)):::}}
25else
26 updir1:=$(updir)/..
27endif
28endif
29
1fd5e000 30pwd:=${shell pwd}
f162ad82 31ifneq "${filter winsup%,${notdir $(pwd)}}" ""
f162ad82
CF
32 here:=${pwd}/cygwin
33else
f162ad82
CF
34 here:=${dir $(pwd)}cygwin
35endif
b13be6f6
CF
36bupdir:=${shell cd $(here)/..; pwd}
37ifneq (,${filter-out /%,$(bupdir)})
1fd5e000 38 bupdir1:=../..
5f3cb291 39 bupdir2:=../../..
1fd5e000 40else
1fd5e000
CF
41ifneq (,${findstring /,$(bupdir)})
42 bupdir1:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(bupdir)):::}}
43else
44 bupdir1:=$(bupdir)/..
45endif
5f3cb291
CF
46ifneq (,${findstring /,$(bupdir1)})
47 bupdir2:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(bupdir1)):::}}
48else
49 bupdir2:=$(bupdir1)/..
50endif
1fd5e000
CF
51endif
52
94597cd0
CF
53zlib_source:=$(updir)/zlib
54zlib_build:=$(bupdir)/zlib
55bz2lib_source:=$(updir)/bz2lib
56bz2lib_build:=$(bupdir)/bz2lib
1fd5e000
CF
57w32api_source:=$(updir)/w32api
58w32api_build:=$(bupdir)/w32api
1fd5e000
CF
59w32api_lib:=$(w32api_build)/lib
60newlib_source:=$(updir1)/newlib
61newlib_build:=$(bupdir1)/newlib
62cygwin_build:=$(bupdir)/cygwin
63cygwin_source:=$(updir)/cygwin
64mingw_build:=$(bupdir)/mingw
65mingw_source:=$(updir)/mingw
66utils_build:=$(bupdir)/utils
67utils_source:=$(updir)/utils
0055a6c6 68ifeq (,${findstring $(newlib_source)/libc/include,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
bc6aa7e1 69newlib_include:=-I$(newlib_source)/libc/include
0055a6c6 70endif
bc6aa7e1
CF
71ifeq (,${findstring $(cygwin_source)/include,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
72cygwin_include:=-I$(cygwin_source)/include
73endif
1fd5e000 74
c6f80f3e 75nostdincxx:=-nostdinc++
b128dd21 76
b128dd21 77nostdlib:=-nostdlib
b128dd21
CF
78
79ifeq (,${nostdlib})
80nostdinc:=
81endif
82
68157644 83INCLUDES:=-I. $(cygwin_include) -I$(cygwin_source) $(newlib_include)
1fd5e000
CF
84ifdef CONFIG_DIR
85INCLUDES+=-I$(CONFIG_DIR)
86endif
87
68157644
YS
88MINGW_LDFLAGS:=-static
89MINGW_CFLAGS:=
90MINGW_CXXFLAGS:=
1fd5e000
CF
91
92GCC_DEFAULT_OPTIONS:=$(CFLAGS_COMMON) $(CFLAGS_CONFIG) $(INCLUDES)
93
94# Link in libc and libm from newlib
95
96LIBC:=$(newlib_build)/libc/libc.a
97LIBM:=$(newlib_build)/libm/libm.a
01859fc4 98CRT0:=$(cygwin_build)/crt0.o
1fd5e000 99
0390476c 100ALL_CFLAGS=$(DEFS) $(MALLOC_DEBUG) $(CFLAGS) $(GCC_DEFAULT_OPTIONS)
b7f68d3e 101ALL_CXXFLAGS=$(DEFS) $(MALLOC_DEBUG) $(CXXFLAGS) $(GCC_DEFAULT_OPTIONS)
1fd5e000
CF
102
103ifndef PREPROCESS
104c=-c
105o=.o
106else
bade737e 107c=-E -dD
1fd5e000
CF
108o=.E
109endif
110
8494f61e 111libgcc:=${subst \,/,${shell $(CC_FOR_TARGET) -print-libgcc-file-name}}
bc6aa7e1
CF
112gcc_libdir:=${word 1,${dir $(libgcc)}}
113ifeq (,${findstring $(gcc_libdir),$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
cb837d41 114GCC_INCLUDE:=${subst //,/,-I$(gcc_libdir)/include}
bc6aa7e1 115endif
1fd5e000 116
b602bb90
DK
117COMPILE_CXX=$(CXX) $c $(if $($(*F)_STDINCFLAGS),,$(nostdincxx) $(nostdinc)) \
118 $(ALL_CXXFLAGS) $(GCC_INCLUDE) -fno-rtti -fno-exceptions
119COMPILE_CC=$(CC) $c $(if $($(*F)_STDINCFLAGS),,$(nostdinc)) $(ALL_CFLAGS) $(GCC_INCLUDE)
1fd5e000 120
68157644 121vpath %.a $(cygwin_build):$(newlib_build)/libc:$(newlib_build)/libm
1fd5e000 122
7f363152
CF
123MAKEOVERRIDES_WORKAROUND=${wordlist 2,1,a b c}
124
125ifneq ($(MAKEOVERRIDES_WORKAROUND),)
126 override MAKE:=$(MAKE) $(MAKEOVERRIDES)
127 MAKEOVERRIDES:=
128 export MAKEOVERRIDES
129endif
1fd5e000 130
72be82da
CF
131ifdef RPATH_ENVVAR
132VERBOSE=1
133endif
134
0ce83ef6
CF
135ifneq "${findstring -B,$(COMPILE_CXX) $(COMPILE_CC)}" ""
136VERBOSE=1
137endif
138
1fd5e000
CF
139.PRECIOUS: %.o
140
141%.o: %.cc
142ifdef VERBOSE
143 $(COMPILE_CXX) -o $(@D)/$(*F)$o $<
144else
8494f61e 145 @echo $(CXX) $c $(CXXFLAGS) ... $(*F).cc
4b9f883e 146 @$(COMPILE_CXX) -o $(@D)/$(*F)$o $<
1fd5e000
CF
147endif
148
149%.o: %.c
150ifdef VERBOSE
151 $(COMPILE_CC) -o $(@D)/$(*F)$o $<
152else
4b9f883e
DD
153 @echo $(CC) $c $(CFLAGS) ... $(*F).c
154 @$(COMPILE_CC) -o $(@D)/$(*F)$o $<
1fd5e000
CF
155endif
156
157$(bupdir1)/libiberty/%.o: $(updir1)/libiberty/%.c
ba87a619 158 @$(MAKE) -C $(@D) $(@F)
1fd5e000
CF
159
160$(w32api_lib)/%.a: $(w32api_lib)/Makefile
ba87a619 161 @$(MAKE) --no-print-dir -C $(@D) $(@F)
1fd5e000 162
b6ddef77 163$(bz2lib)/%.a: $(bz2lib)/Makefile
94597cd0
CF
164 @$(MAKE) --no-print-dir -C $(@D) $(@F)
165
b6ddef77 166$(zlib)/%.a: $(zlib)/Makefile
94597cd0
CF
167 @$(MAKE) --no-print-dir -C $(@D) $(@F)
168
1fd5e000
CF
169all:
170
171# For auto-rebuilding the Makefile
172
173.PRECIOUS: Makefile
174
175Makefile: Makefile.in $(srcdir)/configure.in config.status
176 $(SHELL) config.status
177
178config.status: configure
179 $(SHELL) config.status --recheck
This page took 0.242634 seconds and 5 git commands to generate.