Mercurial > ecos
comparison packages/pkgconf/makevars @ 0:3111d98ba7b3 ecos-v1_1-release
Initial commit of eCos version 1.1
| author | jlarmour |
|---|---|
| date | Tue, 11 May 1999 11:16:07 +0000 |
| parents | |
| children | 443894e2e912 |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:3111d98ba7b3 |
|---|---|
| 1 #=============================================================================== | |
| 2 # | |
| 3 # makevars | |
| 4 # | |
| 5 # This file allows users to control some aspects of the build process. | |
| 6 # | |
| 7 #=============================================================================== | |
| 8 #####COPYRIGHTBEGIN#### | |
| 9 # | |
| 10 # ------------------------------------------- | |
| 11 # The contents of this file are subject to the Cygnus eCos Public License | |
| 12 # Version 1.0 (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://sourceware.cygnus.com/ecos | |
| 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 Cygnus Operating System, released | |
| 22 # September 30, 1998. | |
| 23 # | |
| 24 # The Initial Developer of the Original Code is Cygnus. Portions created | |
| 25 # by Cygnus are Copyright (C) 1998 Cygnus Solutions. All Rights Reserved. | |
| 26 # ------------------------------------------- | |
| 27 # | |
| 28 #####COPYRIGHTEND#### | |
| 29 #=============================================================================== | |
| 30 | |
| 31 # | |
| 32 # Some of the commands used to do builds should generally be specified by | |
| 33 # pkgconf. This is because the commands are target-specific, and it is | |
| 34 # pkgconf that knows about the target architecture and the information held | |
| 35 # in the targets file. Never the less it is desirable to allow users to | |
| 36 # redefine the commands. | |
| 37 # | |
| 38 # First, make automatically defines a number of variables unless it is | |
| 39 # given the -r or --no-builtin-rules arguments. The built-in values are | |
| 40 # unlikely to be correct when doing cross compilation. The following | |
| 41 # checks eliminate any such built-in definitions. | |
| 42 ifeq ($(origin CC),default) | |
| 43 CC := | |
| 44 endif | |
| 45 ifeq ($(origin CXX),default) | |
| 46 CXX := | |
| 47 endif | |
| 48 ifeq ($(origin AR),default) | |
| 49 AR := | |
| 50 endif | |
| 51 ifeq ($(origin LD),default) | |
| 52 LD := | |
| 53 endif | |
| 54 ifeq ($(origin CP),default) | |
| 55 CP := | |
| 56 endif | |
| 57 ifeq ($(origin RM),default) | |
| 58 RM := | |
| 59 endif | |
| 60 ifeq ($(origin TOUCH),default) | |
| 61 TOUCH := | |
| 62 endif | |
| 63 ifeq ($(origin CAT),default) | |
| 64 CAT := | |
| 65 endif | |
| 66 ifeq ($(origin TAIL),default) | |
| 67 TAIL := | |
| 68 endif | |
| 69 | |
| 70 # | |
| 71 # At this stage all of the variables identifying commands will be empty | |
| 72 # or undefined strings, or they will have been set on the make command | |
| 73 # line or in environment variables. | |
| 74 # | |
| 75 # For each command that is not currently defined, a default value | |
| 76 # is defined here. Users may make a persistent change to the commands by | |
| 77 # commenting out the default value and filling in an alternative one. | |
| 78 # | |
| 79 ifeq ($(CC),) | |
| 80 CC := $(PKGCONF_CC) | |
| 81 #CC := | |
| 82 endif | |
| 83 ifeq ($(CXX),) | |
| 84 CXX := $(PKGCONF_CXX) | |
| 85 #CXX := | |
| 86 endif | |
| 87 ifeq ($(AR),) | |
| 88 AR := $(PKGCONF_AR) | |
| 89 #AR := | |
| 90 endif | |
| 91 ifeq ($(LD),) | |
| 92 LD := $(PKGCONF_LD) | |
| 93 #LD := | |
| 94 endif | |
| 95 ifeq ($(OBJCOPY),) | |
| 96 OBJCOPY := $(PKGCONF_OBJCOPY) | |
| 97 #OBJCOPY := | |
| 98 endif | |
| 99 ifeq ($(CP),) | |
| 100 CP := install -m 0644 | |
| 101 #CP := | |
| 102 endif | |
| 103 ifeq ($(RM),) | |
| 104 RM := rm -f | |
| 105 #RM := | |
| 106 endif | |
| 107 ifeq ($(TOUCH),) | |
| 108 TOUCH := touch | |
| 109 #TOUCH := | |
| 110 endif | |
| 111 ifeq ($(CAT),) | |
| 112 CAT := cat | |
| 113 #CAT := | |
| 114 endif | |
| 115 ifeq ($(TAIL),) | |
| 116 TAIL := tail | |
| 117 #tail := | |
| 118 endif | |
| 119 | |
| 120 # | |
| 121 # Next deal with the various compiler flags. None of the flags should | |
| 122 # conflict with any built-in variables, so it is sufficient to check | |
| 123 # that a given flag has not been defined on the make command line or via | |
| 124 # an environment variable. | |
| 125 # | |
| 126 # As with the command variables, users can disable the default | |
| 127 # settings by commenting out one line and filling in the next line. | |
| 128 # | |
| 129 # There are five categories of flags: | |
| 130 # 1) architecture-related, i.e. -mthis -mthat -mthe-other | |
| 131 # 2) error and warning related, e.g. -Wall -Werror | |
| 132 # 3) language-related, e.g. -fno-rtti for C++ code | |
| 133 # 4) debug and code generation, e.g. -g -O2 | |
| 134 # 5) everything else, e.g. -DCYG_RELEASE_DEBUG | |
| 135 # | |
| 136 # For each category there are four variables. The first one, e.g. | |
| 137 # ARCHFLAGS, is used for all build operations. The second, e.g. | |
| 138 # CARCHFLAGS, is used only when compiling to C code (in addition to | |
| 139 # the generic ARCHFLAGS). The third, e.g. CXXARCHFLAGS is used when | |
| 140 # compiling C++ code and the last, LDARCHFLAGS, is used when linking | |
| 141 # executables (typically test programs). | |
| 142 # | |
| 143 | |
| 144 ifeq ($(ARCHFLAGS),) | |
| 145 ARCHFLAGS := $(PKGCONF_ARCHFLAGS) | |
| 146 #ARCHFLAGS := | |
| 147 endif | |
| 148 ifeq ($(CARCHFLAGS),) | |
| 149 CARCHFLAGS := $(PKGCONF_CARCHFLAGS) | |
| 150 #CARCHFLAGS := | |
| 151 endif | |
| 152 ifeq ($(CXXARCHFLAGS),) | |
| 153 CXXARCHFLAGS := $(PKGCONF_CXXARCHFLAGS) | |
| 154 #CXXARCHFLAGS := | |
| 155 endif | |
| 156 ifeq ($(LDARCHFLAGS),) | |
| 157 LDARCHFLAGS := $(PKGCONF_LDARCHFLAGS) | |
| 158 #LDARCHFLAGS := | |
| 159 endif | |
| 160 ifeq ($(ERRFLAGS),) | |
| 161 ERRFLAGS := $(PKGCONF_ERRFLAGS) | |
| 162 #ERRFLAGS := | |
| 163 endif | |
| 164 ifeq ($(CERRFLAGS),) | |
| 165 CERRFLAGS := $(PKGCONF_CERRFLAGS) | |
| 166 #CERRFLAGS := | |
| 167 endif | |
| 168 ifeq ($(CXXERRFLAGS),) | |
| 169 CXXERRFLAGS := $(PKGCONF_CXXERRFLAGS) | |
| 170 #CXXERRFLAGS := | |
| 171 endif | |
| 172 ifeq ($(LDERRFLAGS),) | |
| 173 LDERRFLAGS := $(PKGCONF_LDERRFLAGS) | |
| 174 #LDERRFLAGS := | |
| 175 endif | |
| 176 ifeq ($(LANGFLAGS),) | |
| 177 LANGFLAGS := $(PKGCONF_LANGFLAGS) | |
| 178 #LANGFLAGS := | |
| 179 endif | |
| 180 ifeq ($(CLANGFLAGS),) | |
| 181 CLANGFLAGS := $(PKGCONF_CLANGFLAGS) | |
| 182 #CLANGFLAGS := | |
| 183 endif | |
| 184 ifeq ($(CXXLANGFLAGS),) | |
| 185 CXXLANGFLAGS := $(PKGCONF_CXXLANGFLAGS) | |
| 186 #CXXLANGFLAGS := | |
| 187 endif | |
| 188 ifeq ($(LDLANGFLAGS),) | |
| 189 LDLANGFLAGS := $(PKGCONF_LDLANGFLAGS) | |
| 190 #LDLANGFLAGS := | |
| 191 endif | |
| 192 ifeq ($(DBGFLAGS),) | |
| 193 DBGFLAGS := $(PKGCONF_DBGFLAGS) | |
| 194 #DBGFLAGS := | |
| 195 endif | |
| 196 ifeq ($(CDBGFLAGS),) | |
| 197 CDBGFLAGS := $(PKGCONF_CDBGFLAGS) | |
| 198 #CDBGFLAGS := | |
| 199 endif | |
| 200 ifeq ($(CXXDBGFLAGS),) | |
| 201 CXXDBGFLAGS := $(PKGCONF_CXXDBGFLAGS) | |
| 202 #CXXDBGFLAGS := | |
| 203 endif | |
| 204 ifeq ($(LDDBGFLAGS),) | |
| 205 LDDBGFLAGS := $(PKGCONF_LDDBGFLAGS) | |
| 206 #LDDBGFLAGS := | |
| 207 endif | |
| 208 ifeq ($(EXTRAFLAGS),) | |
| 209 EXTRAFLAGS := $(PKGCONF_EXTRAFLAGS) | |
| 210 #EXTRAFLAGS := | |
| 211 endif | |
| 212 ifeq ($(CEXTRAFLAGS),) | |
| 213 CEXTRAFLAGS := $(PKGCONF_CEXTRAFLAGS) | |
| 214 #CEXTRAFLAGS := | |
| 215 endif | |
| 216 ifeq ($(CXXEXTRAFLAGS),) | |
| 217 CXXEXTRAFLAGS := $(PKGCONF_CXXEXTRAFLAGS) | |
| 218 #CXXEXTRAFLAGS := | |
| 219 endif | |
| 220 ifeq ($(LDEXTRAFLAGS),) | |
| 221 LDEXTRAFLAGS := $(PKGCONF_LDEXTRAFLAGS) | |
| 222 #LDEXTRAFLAGS := | |
| 223 endif | |
| 224 | |
| 225 # | |
| 226 # Now combine all the above flags, so that the build rules are actually legible. | |
| 227 # | |
| 228 CFLAGS := $(ARCHFLAGS) $(CARCHFLAGS) | |
| 229 CFLAGS := $(CFLAGS) $(ERRFLAGS) $(CERRFLAGS) | |
| 230 CFLAGS := $(CFLAGS) $(LANGFLAGS) $(CLANGFLAGS) | |
| 231 CFLAGS := $(CFLAGS) $(DBGFLAGS) $(CDBGFLAGS) | |
| 232 CFLAGS := $(CFLAGS) $(EXTRAFLAGS) $(CEXTRAFLAGS) | |
| 233 CFLAGS := $(strip $(CFLAGS)) | |
| 234 | |
| 235 CXXFLAGS := $(ARCHFLAGS) $(CXXARCHFLAGS) | |
| 236 CXXFLAGS := $(CXXFLAGS) $(ERRFLAGS) $(CXXERRFLAGS) | |
| 237 CXXFLAGS := $(CXXFLAGS) $(LANGFLAGS) $(CXXLANGFLAGS) | |
| 238 CXXFLAGS := $(CXXFLAGS) $(DBGFLAGS) $(CXXDBGFLAGS) | |
| 239 CXXFLAGS := $(CXXFLAGS) $(EXTRAFLAGS) $(CXXEXTRAFLAGS) | |
| 240 CXXFLAGS := $(strip $(CXXFLAGS)) | |
| 241 | |
| 242 LDFLAGS := $(ARCHFLAGS) $(LDARCHFLAGS) | |
| 243 LDFLAGS := $(LDFLAGS) $(ERRFLAGS) $(LDERRFLAGS) | |
| 244 LDFLAGS := $(LDFLAGS) $(LANGFLAGS) $(LDLANGFLAGS) | |
| 245 LDFLAGS := $(LDFLAGS) $(DBGFLAGS) $(LDDBGFLAGS) | |
| 246 LDFLAGS := $(LDFLAGS) $(EXTRAFLAGS) $(LDEXTRAFLAGS) | |
| 247 LDFLAGS := $(strip $(LDFLAGS)) | |
| 248 | |
| 249 # | |
| 250 # Clear the default INCLUDE_PATH. This will be set up in | |
| 251 # makrules.src et al. on the basis of the VPATH environment | |
| 252 # variable. | |
| 253 INCLUDE_PATH := | |
| 254 | |
| 255 # | |
| 256 # Finally, it is possible for users to change the rules that actually | |
| 257 # perform most of the build operations. | |
| 258 | |
| 259 $(PACKAGE)_%.o : %.c | |
| 260 $(CC) -c $(INCLUDE_PATH) $(CFLAGS) -Wp,-MD,$(@:.o=.tmp) -o $@ $< | |
| 261 @echo -e "\\n$@ : $< \\\\" > $(@:.o=.d) | |
| 262 @$(TAIL) -n +2 $(@:.o=.tmp) >> $(@:.o=.d) | |
| 263 @$(RM) $(@:.o=.tmp) | |
| 264 | |
| 265 $(PACKAGE)_%.o : %.cxx | |
| 266 $(CXX) -c $(INCLUDE_PATH) $(CXXFLAGS) -Wp,-MD,$(@:.o=.tmp) -o $@ $< | |
| 267 @echo -e "\\n$@ : $< \\\\" > $(@:.o=.d) | |
| 268 @$(TAIL) -n +2 $(@:.o=.tmp) >> $(@:.o=.d) | |
| 269 @$(RM) $(@:.o=.tmp) | |
| 270 | |
| 271 $(PACKAGE)_%.o : %.S | |
| 272 $(CXX) -c $(INCLUDE_PATH) $(CFLAGS) -Wp,-MD,$(@:.o=.tmp) -o $@ $< | |
| 273 @echo -e "\\n$@ : $< \\\\" > $(@:.o=.d) | |
| 274 @$(TAIL) -n +2 $(@:.o=.tmp) >> $(@:.o=.d) | |
| 275 @$(RM) $(@:.o=.tmp) | |
| 276 |
