source: SVN/cambria/redboot/packages/pkgconf/rules.mak @ 1

Last change on this file since 1 was 1, checked in by Tim Harvey, 2 years ago

restored latest version of files from server backup

Signed-off-by: Tim Harvey <tharvey@…>

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