|
0
|
1 #=============================================================================== |
|
|
2 # |
|
|
3 # makrules.src |
|
|
4 # |
|
|
5 # This file contains generic rules that can be applied to all src |
|
|
6 # directories. |
|
|
7 # |
|
|
8 #=============================================================================== |
|
|
9 #####COPYRIGHTBEGIN#### |
|
|
10 # |
|
|
11 # ------------------------------------------- |
|
|
12 # The contents of this file are subject to the Cygnus eCos Public License |
|
|
13 # Version 1.0 (the "License"); you may not use this file except in |
|
|
14 # compliance with the License. You may obtain a copy of the License at |
|
|
15 # http://sourceware.cygnus.com/ecos |
|
|
16 # |
|
|
17 # Software distributed under the License is distributed on an "AS IS" |
|
|
18 # basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
|
|
19 # License for the specific language governing rights and limitations under |
|
|
20 # the License. |
|
|
21 # |
|
|
22 # The Original Code is eCos - Embedded Cygnus Operating System, released |
|
|
23 # September 30, 1998. |
|
|
24 # |
|
|
25 # The Initial Developer of the Original Code is Cygnus. Portions created |
|
|
26 # by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. |
|
|
27 # ------------------------------------------- |
|
|
28 # |
|
|
29 #####COPYRIGHTEND#### |
|
|
30 #=============================================================================== |
|
|
31 |
|
|
32 .PHONY: default build clean |
|
|
33 |
|
|
34 # Source files can be picked up from the build tree or the component |
|
|
35 # repository. This allows copies of the sources to be made in the |
|
|
36 # build tree and edited there. |
|
|
37 VPATH := . $(COMPONENT_REPOSITORY)/$($(PACKAGE)_DIR)/src |
|
|
38 |
|
|
39 # The object files and the dependency files can be deduced mainly |
|
|
40 # from the list of source files. OTHER_OBJS and OTHER_DEPS are |
|
|
41 # provided as an escape mechanism, as is OTHER_TARGETS. |
|
|
42 |
|
|
43 OBJECTS := $(COMPILE:.cxx=.o) |
|
|
44 OBJECTS := $(OBJECTS:.c=.o) |
|
|
45 OBJECTS := $(OBJECTS:.S=.o) |
|
|
46 OBJECTS := $(foreach obj,$(OBJECTS),$(dir $(obj))$(PACKAGE)_$(notdir $(obj))) |
|
|
47 DEPS := $(OBJECTS:.o=.d) |
|
|
48 |
|
|
49 OBJECTS := $(OBJECTS) $(OTHER_OBJS) |
|
|
50 DEPS := $(DEPS) $(OTHER_DEPS) |
|
|
51 |
|
|
52 # The header file search path is as follows: |
|
|
53 # |
|
|
54 # $(PREFIX)/include |
|
|
55 # These headers are what will be used by application code. |
|
|
56 # |
|
|
57 # . |
|
|
58 # Header files private to a package and copied into the build tree. |
|
|
59 # |
|
|
60 # $(COMPONENT_REPOSITORY)/<package>/src |
|
|
61 # Header files private to a package and still in the repository. |
|
|
62 # |
|
|
63 # It is possible for additional paths to be specified by the user, |
|
|
64 # typically by editing the makevars file. Any such search paths take |
|
|
65 # precedence over the default path. |
|
|
66 |
|
|
67 INCLUDE_PATH := $(INCLUDE_PATH) -I$(PREFIX)/include $(foreach dir,$(VPATH),-I$(dir)) |
|
|
68 |
|
|
69 # |
|
|
70 # This is the default target. It is responsible for updating the library, |
|
|
71 # building any special targets, and updating the dependency information. |
|
|
72 |
|
|
73 build: $(LIBRARY).stamp $(OTHER_TARGETS) |
|
|
74 ifneq ($(strip $(DEPS)),) |
|
|
75 @$(CAT) $(DEPS) > makefile.deps |
|
|
76 endif |
|
|
77 |
|
|
78 |
|
|
79 # Updating the library involves using ar with any object files that |
|
|
80 # have been rebuilt. After any s |
|
|
81 |
|
|
82 $(LIBRARY).stamp: $(OBJECTS) |
|
|
83 ifneq ($(strip $(OBJECTS)),) |
|
|
84 $(AR) crs $(PREFIX)/lib/$(LIBRARY) $? |
|
|
85 endif |
|
|
86 $(TOUCH) $@ |
|
|
87 |
|
|
88 |
|
|
89 # The clean target cleans up the intermediate files, any object |
|
|
90 # files, and any dependency files. |
|
|
91 |
|
|
92 clean: $(OTHER_CLEAN) |
|
|
93 $(RM) $(LIBRARY).stamp |
|
|
94 @$(RM) makefile.deps |
|
|
95 ifneq ($(strip $(OBJECTS)),) |
|
|
96 $(RM) $(OBJECTS) |
|
|
97 endif |
|
|
98 ifneq ($(strip $(DEPS)),) |
|
|
99 @$(RM) $(DEPS) |
|
|
100 endif |
|
|
101 |
|
|
102 # |
|
|
103 # These file dependencies ensure that all files are rebuilt if |
|
|
104 # there is a change to the build environment, e.g. if a different |
|
|
105 # compiler is being used. |
|
|
106 # |
|
|
107 ifneq ($(strip $(OBJECTS)),) |
|
|
108 $(OBJECTS) : $(BUILD_TREE)/pkgconf/pkgconf.mak |
|
|
109 $(OBJECTS) : $(BUILD_TREE)/pkgconf/makevars $(PACKAGE_RULES_FILE) |
|
|
110 endif |
|
|
111 ifneq ($(strip $(OTHER_TARGETS)),) |
|
|
112 $(OTHER_TARGETS) : $(BUILD_TREE)/pkgconf/pkgconf.mak |
|
|
113 $(OTHER_TARGETS) : $(BUILD_TREE)/pkgconf/makevars $(PACKAGE_RULES_FILE) |
|
|
114 endif |
|
|
115 |
|
|
116 # |
|
|
117 # This rule reads in any previously generated dependency information. |
|
|
118 # |
|
|
119 ifneq ($(wildcard makefile.deps),) |
|
|
120 include makefile.deps |
|
|
121 endif |
|
|
122 |
|
|
123 |