1 #=============================================================================
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
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
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####
45 # Purpose: Generic rules for inclusion by all package makefiles
48 #####DESCRIPTIONEND####
49 #=============================================================================
51 # FIXME: This definition belongs in the top-level makefile.
54 .PHONY
: default build
clean tests headers mlt_headers
56 # include any dependency rules generated previously
57 ifneq ($(wildcard *.deps
),)
58 include $(wildcard *.deps
)
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"
72 CFLAGS
:= -finline-limit
=7000 $(CFLAGS
)
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")
89 @mkdir
-p
`cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
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
) > $@
99 @mkdir
-p
`cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
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
) > $@
108 ifeq ($(HOST
),CYGWIN
)
109 @mkdir
-p
`cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
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
) > $@
118 ifeq ($(HOST
),CYGWIN
)
119 @mkdir
-p
`cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
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
) > $@
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")
131 ifeq ($(HOST
),CYGWIN
)
132 @mkdir
-p
`cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
136 $(CC
) -c
$(INCLUDE_PATH
) -I
$(dir $<) $(ACTUAL_CFLAGS
) -Wp
,-MD
,$(@
:.d
=.tmp
) -o
$(@
:.d
=.o
) $<
137 @sed
-e
'/^ *\\/d' -e
"s#.*: #$@: #" $(@
:.d
=.tmp
) > $@
141 ifeq ($(HOST
),CYGWIN
)
142 @mkdir
-p
`cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
146 $(CC
) -c
$(INCLUDE_PATH
) -I
$(dir $<) $(ACTUAL_CXXFLAGS
) -Wp
,-MD
,$(@
:.d
=.tmp
) -o
$(@
:.d
=.o
) $<
147 @sed
-e
'/^ *\\/d' -e
"s#.*: #$@: #" $(@
:.d
=.tmp
) > $@
151 ifeq ($(HOST
),CYGWIN
)
152 @mkdir
-p
`cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
156 $(CC
) -c
$(INCLUDE_PATH
) -I
$(dir $<) $(ACTUAL_CXXFLAGS
) -Wp
,-MD
,$(@
:.d
=.tmp
) -o
$(@
:.d
=.o
) $<
157 @sed
-e
'/^ *\\/d' -e
"s#.*: #$@: #" $(@
:.d
=.tmp
) > $@
161 ifeq ($(HOST
),CYGWIN
)
162 @mkdir
-p
`cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
166 $(CC
) -c
$(INCLUDE_PATH
) -I
$(dir $<) $(ACTUAL_CFLAGS
) -Wp
,-MD
,$(@
:.d
=.tmp
) -o
$(@
:.d
=.o
) $<
167 @sed
-e
'/^ *\\/d' -e
"s#.*: #$@: #" $(@
:.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"`
177 ifneq ($(IGNORE_LINK_ERRORS
),)
178 -$(CC
) -L
$(PREFIX
)/lib
-Ttarget.
ld -o
$@
$(<:.d
=.o
) $(LDFLAGS
)
180 $(CC
) -L
$(PREFIX
)/lib
-Ttarget.
ld -o
$@
$(<:.d
=.o
) $(LDFLAGS
)
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
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
)
198 # rule to clean the build tree
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 $@
)