1 |
27 |
unneback |
#=============================================================================
|
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.
|
53 |
|
|
export HOST_CC := gcc
|
54 |
|
|
|
55 |
|
|
.PHONY: default build clean tests headers mlt_headers
|
56 |
|
|
|
57 |
|
|
# include any dependency rules generated previously
|
58 |
|
|
ifneq ($(wildcard *.deps),)
|
59 |
|
|
include $(wildcard *.deps)
|
60 |
|
|
endif
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
# pattern matching rules to generate a library object from source code
|
64 |
|
|
# object filenames are prefixed to avoid name clashes
|
65 |
|
|
# a single dependency rule is generated (file extension = ".o.d")
|
66 |
|
|
%.o.d : %.c
|
67 |
|
|
ifeq ($(HOST),CYGWIN)
|
68 |
|
|
@mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
|
69 |
|
|
else
|
70 |
|
|
@mkdir -p $(dir $@)
|
71 |
|
|
endif
|
72 |
|
|
$(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
|
73 |
|
|
@sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@
|
74 |
|
|
@rm $(@:.o.d=.tmp)
|
75 |
|
|
|
76 |
|
|
%.o.d : %.cxx
|
77 |
|
|
ifeq ($(HOST),CYGWIN)
|
78 |
|
|
@mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
|
79 |
|
|
else
|
80 |
|
|
@mkdir -p $(dir $@)
|
81 |
|
|
endif
|
82 |
|
|
$(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
|
83 |
|
|
@sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@
|
84 |
|
|
@rm $(@:.o.d=.tmp)
|
85 |
|
|
|
86 |
|
|
%.o.d : %.cpp
|
87 |
|
|
ifeq ($(HOST),CYGWIN)
|
88 |
|
|
@mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
|
89 |
|
|
else
|
90 |
|
|
@mkdir -p $(dir $@)
|
91 |
|
|
endif
|
92 |
|
|
$(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
|
93 |
|
|
@sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@
|
94 |
|
|
@rm $(@:.o.d=.tmp)
|
95 |
|
|
|
96 |
|
|
%.o.d : %.S
|
97 |
|
|
ifeq ($(HOST),CYGWIN)
|
98 |
|
|
@mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
|
99 |
|
|
else
|
100 |
|
|
@mkdir -p $(dir $@)
|
101 |
|
|
endif
|
102 |
|
|
$(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
|
103 |
|
|
@sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.o.d=.tmp) > $@
|
104 |
|
|
@rm $(@:.o.d=.tmp)
|
105 |
|
|
|
106 |
|
|
# pattern matching rules to generate a test object from source code
|
107 |
|
|
# object filenames are not prefixed
|
108 |
|
|
# a single dependency rule is generated (file extension = ".d")
|
109 |
|
|
%.d : %.c
|
110 |
|
|
ifeq ($(HOST),CYGWIN)
|
111 |
|
|
@mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
|
112 |
|
|
else
|
113 |
|
|
@mkdir -p $(dir $@)
|
114 |
|
|
endif
|
115 |
|
|
$(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $<
|
116 |
|
|
@sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.d=.tmp) > $@
|
117 |
|
|
@rm $(@:.d=.tmp)
|
118 |
|
|
|
119 |
|
|
%.d : %.cxx
|
120 |
|
|
ifeq ($(HOST),CYGWIN)
|
121 |
|
|
@mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
|
122 |
|
|
else
|
123 |
|
|
@mkdir -p $(dir $@)
|
124 |
|
|
endif
|
125 |
|
|
$(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $<
|
126 |
|
|
@sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.d=.tmp) > $@
|
127 |
|
|
@rm $(@:.d=.tmp)
|
128 |
|
|
|
129 |
|
|
%.d : %.cpp
|
130 |
|
|
ifeq ($(HOST),CYGWIN)
|
131 |
|
|
@mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
|
132 |
|
|
else
|
133 |
|
|
@mkdir -p $(dir $@)
|
134 |
|
|
endif
|
135 |
|
|
$(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $<
|
136 |
|
|
@sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.d=.tmp) > $@
|
137 |
|
|
@rm $(@:.d=.tmp)
|
138 |
|
|
|
139 |
|
|
%.d : %.S
|
140 |
|
|
ifeq ($(HOST),CYGWIN)
|
141 |
|
|
@mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
|
142 |
|
|
else
|
143 |
|
|
@mkdir -p $(dir $@)
|
144 |
|
|
endif
|
145 |
|
|
$(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $<
|
146 |
|
|
@sed -e '/^ *\\/d' -e "s#.*: #$@: #" $(@:.d=.tmp) > $@
|
147 |
|
|
@rm $(@:.d=.tmp)
|
148 |
|
|
|
149 |
|
|
# rule to generate a test executable from object code
|
150 |
|
|
$(PREFIX)/tests/$(PACKAGE)/%$(EXEEXT): %.d $(wildcard $(PREFIX)/lib/target.ld) $(wildcard $(PREFIX)/lib/*.[ao])
|
151 |
|
|
ifeq ($(HOST),CYGWIN)
|
152 |
|
|
@mkdir -p `cygpath -w "$(dir $@)" | sed "s@\\\\\\\\@/@g"`
|
153 |
|
|
else
|
154 |
|
|
@mkdir -p $(dir $@)
|
155 |
|
|
endif
|
156 |
|
|
ifneq ($(IGNORE_LINK_ERRORS),)
|
157 |
|
|
-$(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ $(<:.d=.o)
|
158 |
|
|
else
|
159 |
|
|
$(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ $(<:.d=.o)
|
160 |
|
|
endif
|
161 |
|
|
|
162 |
|
|
# rule to generate all tests and create a dependency file "tests.deps" by
|
163 |
|
|
# concatenating the individual dependency rule files (file extension = ".d")
|
164 |
|
|
# generated during compilation
|
165 |
|
|
tests: tests.stamp
|
166 |
|
|
|
167 |
|
|
TESTS := $(TESTS:.cpp=)
|
168 |
|
|
TESTS := $(TESTS:.cxx=)
|
169 |
|
|
TESTS := $(TESTS:.c=)
|
170 |
|
|
TESTS := $(TESTS:.S=)
|
171 |
|
|
tests.stamp: $(foreach target,$(TESTS),$(target).d $(PREFIX)/tests/$(PACKAGE)/$(target)$(EXEEXT))
|
172 |
|
|
ifneq ($(strip $(TESTS)),)
|
173 |
|
|
@cat $(TESTS:%=%.d) > $(@:.stamp=.deps)
|
174 |
|
|
endif
|
175 |
|
|
@touch $@
|
176 |
|
|
|
177 |
|
|
# rule to clean the build tree
|
178 |
|
|
clean:
|
179 |
|
|
@find . -type f -print | grep -v makefile | xargs rm -f
|
180 |
|
|
|
181 |
|
|
# rule to copy MLT files
|
182 |
|
|
mlt_headers: $(foreach x,$(MLT),$(PREFIX)/include/pkgconf/$(notdir $x))
|
183 |
|
|
|
184 |
|
|
$(foreach x,$(MLT),$(PREFIX)/include/pkgconf/$(notdir $x)): $(MLT)
|
185 |
|
|
@cp $(dir $<)/$(notdir $@) $(PREFIX)/include/pkgconf
|
186 |
|
|
@chmod u+w $(PREFIX)/include/pkgconf/$(notdir $@)
|
187 |
|
|
|
188 |
|
|
# end of file
|