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