comparison packages/pkgconf/rules.mak @ 76:435cced73e2f ecos-v1_3_1-release

eCos v1.3.1 merged from eCos master repository on 2000-03-27-23:22:51-BST
author jlarmour
date Tue, 28 Mar 2000 14:10:45 +0000
parents
children a9ac27ec7abc
comparison
equal deleted inserted replaced
75:41bf073c0c32 76:435cced73e2f
1 #=============================================================================
2 #
3 # rules.mak
4 #
5 # Generic rules for inclusion by all package makefiles.
6 #
7 #=============================================================================
8 #####COPYRIGHTBEGIN####
9 #
10 # -------------------------------------------
11 # The contents of this file are subject to the Red Hat eCos Public License
12 # Version 1.1 (the "License"); you may not use this file except in
13 # compliance with the License. You may obtain a copy of the License at
14 # http://www.redhat.com/
15 #
16 # Software distributed under the License is distributed on an "AS IS"
17 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
18 # License for the specific language governing rights and limitations under
19 # the License.
20 #
21 # The Original Code is eCos - Embedded Configurable Operating System,
22 # released September 30, 1998.
23 #
24 # The Initial Developer of the Original Code is Red Hat.
25 # Portions created by Red Hat are
26 # Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
27 # All Rights Reserved.
28 # -------------------------------------------
29 #
30 #####COPYRIGHTEND####
31 #=============================================================================
32 #####DESCRIPTIONBEGIN####
33 #
34 # Author(s): jld
35 # Contributors: bartv
36 # Date: 1999-11-04
37 # Purpose: Generic rules for inclusion by all package makefiles
38 # Description:
39 #
40 #####DESCRIPTIONEND####
41 #=============================================================================
42
43 .PHONY: default build clean tests headers mlt_headers
44
45 # include any dependency rules generated previously
46 ifneq ($(wildcard *.deps),)
47 include $(wildcard *.deps)
48 endif
49
50 # pattern matching rules to generate a library object from source code
51 # object filenames are prefixed to avoid name clashes
52 # a single dependency rule is generated (file extension = ".o.d")
53 %.o.d : %.c
54 @mkdir -p $(dir $@)
55 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
56 @echo $@ ':' $< '\' > $@
57 @tail +2 $(@:.o.d=.tmp) >> $@
58 @echo >> $@
59 @rm $(@:.o.d=.tmp)
60
61 %.o.d : %.cxx
62 @mkdir -p $(dir $@)
63 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
64 @echo $@ ':' $< '\' > $@
65 @tail +2 $(@:.o.d=.tmp) >> $@
66 @echo >> $@
67 @rm $(@:.o.d=.tmp)
68
69 %.o.d : %.S
70 @mkdir -p $(dir $@)
71 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.o.d=.tmp) -o $(dir $@)$(OBJECT_PREFIX)_$(notdir $(@:.o.d=.o)) $<
72 @echo $@ ':' $< '\' > $@
73 @tail +2 $(@:.o.d=.tmp) >> $@
74 @echo >> $@
75 @rm $(@:.o.d=.tmp)
76
77 # pattern matching rules to generate a test object from source code
78 # object filenames are not prefixed
79 # a single dependency rule is generated (file extension = ".d")
80 %.d : %.c
81 @mkdir -p $(dir $@)
82 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $<
83 @echo $@ ':' $< '\' > $@
84 @tail +2 $(@:.d=.tmp) >> $@
85 @echo >> $@
86 @rm $(@:.d=.tmp)
87
88 %.d : %.cxx
89 @mkdir -p $(dir $@)
90 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $<
91 @echo $@ ':' $< '\' > $@
92 @tail +2 $(@:.d=.tmp) >> $@
93 @echo >> $@
94 @rm $(@:.d=.tmp)
95
96 %.d : %.S
97 @mkdir -p $(dir $@)
98 $(CC) -c $(INCLUDE_PATH) -I$(dir $<) $(CFLAGS) -Wp,-MD,$(@:.d=.tmp) -o $(@:.d=.o) $<
99 @echo $@ ':' $< '\' > $@
100 @tail +2 $(@:.d=.tmp) >> $@
101 @echo >> $@
102 @rm $(@:.d=.tmp)
103
104 # rule to generate a test executable from object code
105 $(PREFIX)/tests/$(PACKAGE)/%$(EXEEXT): %.d $(wildcard $(PREFIX)/lib/target.ld) $(wildcard $(PREFIX)/lib/*.[ao])
106 @mkdir -p $(dir $@)
107 ifneq ($(IGNORE_LINK_ERRORS),)
108 -$(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ $(<:.d=.o)
109 else
110 $(CC) $(LDFLAGS) -L$(PREFIX)/lib -Ttarget.ld -o $@ $(<:.d=.o)
111 endif
112
113 # rule to generate all tests and create a dependency file "tests.deps" by
114 # concatenating the individual dependency rule files (file extension = ".d")
115 # generated during compilation
116 tests: tests.stamp
117
118 TESTS := $(TESTS:.cxx=)
119 TESTS := $(TESTS:.c=)
120 TESTS := $(TESTS:.S=)
121 tests.stamp: $(foreach target,$(TESTS),$(target).d $(PREFIX)/tests/$(PACKAGE)/$(target)$(EXEEXT))
122 ifneq ($(strip $(TESTS)),)
123 @cat $(TESTS:=.d) > $(@:.stamp=.deps)
124 endif
125 @touch $@
126
127 # rule to clean the build tree
128 clean:
129 @find . -type f -not -name makefile -print0 | xargs -0 rm -f
130
131 # rule to copy MLT files
132 mlt_headers:
133 ifneq ($(strip $(MLT)),)
134 @cp -u $(MLT) $(PREFIX)/include/pkgconf
135 @chmod u+w $(PREFIX)/include/pkgconf/mlt*.*
136 endif
137
138 # end of file