Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Makefile.common « winsup - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d496fb8d6ff0e94a9ca889dee09b5f72f5a02718 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# Makefile.common - common definitions for the winsup directory
#
# Copyright 2000, 2001, 2002, 2003, 2004, 2005 Red Hat, Inc.
#
# 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.

CFLAGS_COMMON:=-Wall -Wstrict-aliasing -Wwrite-strings -fno-common -pipe -fbuiltin -fmessage-length=0# -finline-functions
MALLOC_DEBUG:=#-DMALLOC_DEBUG -I/cygnus/src/uberbaum/winsup/cygwin/dlmalloc
MALLOC_OBJ:=#/cygnus/src/uberbaum/winsup/cygwin/dlmalloc/malloc.o

override srcdir:=${shell cd $(srcdir); pwd}
ifneq (,${filter-out /%,$(srcdir)})
    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}
ifneq "${filter winsup%,${notdir $(pwd)}}" ""
    here:=${pwd}/cygwin
else
    here:=${dir $(pwd)}cygwin
endif
bupdir:=${shell cd $(here)/..; pwd}
ifneq (,${filter-out /%,$(bupdir)})
    bupdir1:=../..
    bupdir2:=../../..
else
ifneq (,${findstring /,$(bupdir)})
    bupdir1:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(bupdir)):::}}
else
    bupdir1:=$(bupdir)/..
endif
ifneq (,${findstring /,$(bupdir1)})
    bupdir2:=${patsubst %:::,%,${patsubst %/:::,%,$(dir $(bupdir1)):::}}
else
    bupdir2:=$(bupdir1)/..
endif
endif

zlib_source:=$(updir)/zlib
zlib_build:=$(bupdir)/zlib
bz2lib_source:=$(updir)/bz2lib
bz2lib_build:=$(bupdir)/bz2lib
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
ifeq (,${findstring $(newlib_source)/libc/include,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
newlib_include:=-I$(newlib_source)/libc/include
endif
ifeq (,${findstring $(cygwin_source)/include,$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
cygwin_include:=-I$(cygwin_source)/include
endif

# Try to determine what directories are available in winsup.
# Attempt to properly detect missing mingw or w32api and adjust command
# line parameters appropriately

# nostdinc:=${shell [ -d "$(updir)/w32api" ] && echo "-nostdinc"}
# ifneq (,$(nostdinc))
nostdincxx:=-nostdinc++
# ifeq (,${findstring $(w32api_source),$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
w32api_include:=-I$(w32api_source)/include
# endif
# endif

mingw_include:=${shell [ -d "$(mingw_source)/include" ] && echo "-I$(mingw_source)/include"}
ifneq (,$(mingw_include))
nostdlib:=-nostdlib
else
nostdlib:=
endif

ifeq (,${nostdlib})
nostdinc:=
endif

INCLUDES:=-I. $(cygwin_include) -I$(cygwin_source) $(newlib_include) $(w32api_include)
ifdef CONFIG_DIR
INCLUDES+=-I$(CONFIG_DIR)
endif

MINGW_INCLUDES:=${mingw_include} $(w32api_include)
MINGW_CFLAGS:=-mno-cygwin $(MINGW_INCLUDES)
MINGW_CXXFLAGS:=${filter-out $(newlib_source)/%,$(CXXFLAGS)} -mno-cygwin $(MINGW_INCLUDES)
MINGW_LDFLAGS:=-L${mingw_build} -L${mingw_build}/mingwex

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
CRT0:=$(cygwin_build)/crt0.o

ALL_CFLAGS:=$(DEFS) $(MALLOC_DEBUG) $(CFLAGS) $(GCC_DEFAULT_OPTIONS)
ALL_CXXFLAGS=$(DEFS) $(MALLOC_DEBUG) $(CXXFLAGS) $(GCC_DEFAULT_OPTIONS)

ifndef PREPROCESS
c=-c
o=.o
else
c=-E -dD
o=.E
endif

libgcc:=${subst \,/,${shell $(CC_FOR_TARGET) -print-libgcc-file-name}}
gcc_libdir:=${word 1,${dir $(libgcc)}}
ifeq (,${findstring $(gcc_libdir),$(CFLAGS) $(CXXFLAGS) $(CXX) $(CC)})
GCC_INCLUDE:=${subst //,/,-I$(gcc_libdir)/include}
endif

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)

vpath %.a	$(cygwin_build):$(w32api_lib):$(newlib_build)/libc:$(newlib_build)/libm

MAKEOVERRIDES_WORKAROUND=${wordlist 2,1,a b c}

ifneq ($(MAKEOVERRIDES_WORKAROUND),)
    override MAKE:=$(MAKE) $(MAKEOVERRIDES)
    MAKEOVERRIDES:=
    export MAKEOVERRIDES
endif

ifdef RPATH_ENVVAR
VERBOSE=1
endif

ifneq "${findstring -B,$(COMPILE_CXX) $(COMPILE_CC)}" ""
VERBOSE=1
endif

.PRECIOUS: %.o

%.o: %.cc
ifdef VERBOSE
	$(COMPILE_CXX) -o $(@D)/$(*F)$o $<
else
	@echo $(CXX) $c $(CXXFLAGS) ... $(*F).cc
	@$(COMPILE_CXX) -o $(@D)/$(*F)$o $<
endif

%.o: %.c
ifdef VERBOSE
	$(COMPILE_CC) -o $(@D)/$(*F)$o $<
else
	@echo $(CC) $c $(CFLAGS) ... $(*F).c
	@$(COMPILE_CC) -o $(@D)/$(*F)$o $<
endif

$(bupdir1)/libiberty/%.o: $(updir1)/libiberty/%.c
	@$(MAKE) -C $(@D) $(@F)

$(w32api_lib)/%.a: $(w32api_lib)/Makefile
	@$(MAKE) --no-print-dir -C $(@D) $(@F)

$(bz2lib)/%.a: $(bz2lib)/Makefile
	@$(MAKE) --no-print-dir -C $(@D) $(@F)

$(zlib)/%.a: $(zlib)/Makefile
	@$(MAKE) --no-print-dir -C $(@D) $(@F)

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