bootloader: bumped the version to 2.1
[nios2ecos.git] / tools / gcc4libstdxx / ecos / pkgconf / rules.mak
blobaddd1e903c9c06452c1de6e9ead7e5b7cccdf441
1 #=============================================================================
3 # rules.mak
5 # Generic rules for inclusion by all package makefiles.
7 #=============================================================================
8 ## ####ECOSGPLCOPYRIGHTBEGIN####
9 ## -------------------------------------------
10 ## This file is part of eCos, the Embedded Configurable Operating System.
11 ## Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
13 ## eCos is free software; you can redistribute it and/or modify it under
14 ## the terms of the GNU General Public License as published by the Free
15 ## Software Foundation; either version 2 or (at your option) any later
16 ## version.
18 ## eCos is distributed in the hope that it will be useful, but WITHOUT
19 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 ## for more details.
23 ## You should have received a copy of the GNU General Public License
24 ## along with eCos; if not, write to the Free Software Foundation, Inc.,
25 ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
27 ## As a special exception, if other files instantiate templates or use
28 ## macros or inline functions from this file, or you compile this file
29 ## and link it with other works to produce a work based on this file,
30 ## this file does not by itself cause the resulting work to be covered by
31 ## the GNU General Public License. However the source code for this file
32 ## must still be made available in accordance with section (3) of the GNU
33 ## General Public License v2.
35 ## This exception does not invalidate any other reasons why a work based
36 ## on this file might be covered by the GNU General Public License.
37 ## -------------------------------------------
38 ## ####ECOSGPLCOPYRIGHTEND####
39 #=============================================================================
40 #####DESCRIPTIONBEGIN####
42 # Author(s): jld
43 # Contributors: bartv
44 # Date: 1999-11-04
45 # Purpose: Generic rules for inclusion by all package makefiles
46 # Description:
48 #####DESCRIPTIONEND####
49 #=============================================================================
51 # FIXME: This definition belongs in the top-level makefile.
52 export HOST_CC := gcc
54 .PHONY: default build clean tests headers mlt_headers
56 # include any dependency rules generated previously
57 ifneq ($(wildcard *.deps),)
58 include $(wildcard *.deps)
59 endif
61 # GCC since 2.95 does -finit-priority by default so remove it from old HALs
62 CFLAGS := $(subst -finit-priority,,$(CFLAGS))
64 # -fvtable-gc is known to be broken in all recent GCC.
65 CFLAGS := $(subst -fvtable-gc,,$(CFLAGS))
67 # To support more recent GCC whilst preserving existing behaviour, we need
68 # to increase the inlining limit globally from the default 600. Note this
69 # will break GCC 2.95 based tools and earlier. You must use "make OLDGCC=1"
70 # to avoid this.
71 ifneq ($(OLDGCC),1)
72 CFLAGS := -finline-limit=7000 $(CFLAGS)
73 endif
75 # Separate C++ flags out from C flags.
76 ACTUAL_CFLAGS = $(CFLAGS)
77 ACTUAL_CFLAGS := $(subst -fno-rtti,,$(ACTUAL_CFLAGS))
78 ACTUAL_CFLAGS := $(subst -frtti,,$(ACTUAL_CFLAGS))
79 ACTUAL_CFLAGS := $(subst -Woverloaded-virtual,,$(ACTUAL_CFLAGS))
80 ACTUAL_CFLAGS := $(subst -fvtable-gc,,$(ACTUAL_CFLAGS))
82 ACTUAL_CXXFLAGS = $(subst -Wstrict-prototypes,,$(CFLAGS))
84 # pattern matching rules to generate a library object from source code
85 # object filenames are prefixed to avoid name clashes
86 # a single dependency rule is generated (file extension = ".o.d")
87 %.o.d : %.c
88 ifeq ($(HOST),CYGWIN)
89 @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
90 else
91 @mkdir -p $(dir $@)
92 endif
93 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(ACTUAL_CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
94 @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@
95 @rm $(@:.o.d=.tmp)
97 %.o.d : %.cxx
98 ifeq ($(HOST),CYGWIN)
99 @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
100 else
101 @mkdir -p $(dir $@)
102 endif
103 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(ACTUAL_CXXFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
104 @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@
105 @rm $(@:.o.d=.tmp)
107 %.o.d : %.cpp
108 ifeq ($(HOST),CYGWIN)
109 @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
110 else
111 @mkdir -p $(dir $@)
112 endif
113 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(ACTUAL_CXXFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
114 @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@
115 @rm $(@:.o.d=.tmp)
117 %.o.d : %.S
118 ifeq ($(HOST),CYGWIN)
119 @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
120 else
121 @mkdir -p $(dir $@)
122 endif
123 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(ACTUAL_CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
124 @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@
125 @rm $(@:.o.d=.tmp)
127 # pattern matching rules to generate a test object from source code
128 # object filenames are not prefixed
129 # a single dependency rule is generated (file extension = ".d")
130 %.d : %.c
131 ifeq ($(HOST),CYGWIN)
132 @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
133 else
134 @mkdir -p $(dir $@)
135 endif
136 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(ACTUAL_CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $<
137 @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.d=.tmp) > $@
138 @rm $(@:.d=.tmp)
140 %.d : %.cxx
141 ifeq ($(HOST),CYGWIN)
142 @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
143 else
144 @mkdir -p $(dir $@)
145 endif
146 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(ACTUAL_CXXFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $<
147 @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.d=.tmp) > $@
148 @rm $(@:.d=.tmp)
150 %.d : %.cpp
151 ifeq ($(HOST),CYGWIN)
152 @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
153 else
154 @mkdir -p $(dir $@)
155 endif
156 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(ACTUAL_CXXFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $<
157 @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.d=.tmp) > $@
158 @rm $(@:.d=.tmp)
160 %.d : %.S
161 ifeq ($(HOST),CYGWIN)
162 @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
163 else
164 @mkdir -p $(dir $@)
165 endif
166 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(ACTUAL_CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $<
167 @sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.d=.tmp) > $@
168 @rm $(@:.d=.tmp)
170 # rule to generate a test executable from object code
171 $(PREFIX)/tests/$(PACKAGE)/%$(EXEEXT): %.d $(wildcard $(PREFIX)/lib/target.ld) $(wildcard $(PREFIX)/lib/*.[ao])
172 ifeq ($(HOST),CYGWIN)
173 @mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
174 else
175 @mkdir -p $(dir $@)
176 endif
177 ifneq ($(IGNORE_LINK_ERRORS),)
178 -$(CC) -L$(PREFIX)/lib -Ttarget.ld -o $@ $(<:.d=.o) $(LDFLAGS)
179 else
180 $(CC) -L$(PREFIX)/lib -Ttarget.ld -o $@ $(<:.d=.o) $(LDFLAGS)
181 endif
183 # rule to generate all tests and create a dependency file "tests.deps" by
184 # concatenating the individual dependency rule files (file extension = ".d")
185 # generated during compilation
186 tests: tests.stamp
188 TESTS := $(TESTS:.cpp=)
189 TESTS := $(TESTS:.cxx=)
190 TESTS := $(TESTS:.c=)
191 TESTS := $(TESTS:.S=)
192 tests.stamp: $(foreach target,$(TESTS),$(target).d $(PREFIX)/tests/$(PACKAGE)/$(target)$(EXEEXT))
193 ifneq ($(strip $(TESTS)),)
194 @cat $(TESTS:%=%.d) > $(@:.stamp=.deps)
195 endif
196 @touch $@
198 # rule to clean the build tree
199 clean:
200 @find . -type f -print | grep -v makefile | xargs rm -f
202 # rule to copy MLT files
203 mlt_headers: $(foreach x,$(MLT),$(PREFIX)/include/pkgconf/$(notdir $x))
205 $(foreach x,$(MLT),$(PREFIX)/include/pkgconf/$(notdir $x)): $(MLT)
206 @cp $(dir $<)/$(notdir $@) $(PREFIX)/include/pkgconf
207 @chmod u+w $(PREFIX)/include/pkgconf/$(notdir $@)
209 # end of file