9
9
# =============================================================
10
10
# OS-specific definitions
11
11
# =============================================================
12
+ COMMA =,
13
+ OPEN_PAREN =(
14
+ CLOSE_PAREN =)
15
+ BACKSLASH =\$(nullstring )
12
16
ifneq ($(ComSpec )$(COMSPEC ) ,)
13
17
O_SYS =Windows
14
18
RM =del /F /Q
15
19
MKDIR =mkdir
16
20
CP =copy /Y
17
21
TYPE =type
18
- PS =\ $( nullstring )
22
+ PS =$( BACKSLASH )
19
23
Q =
20
24
coQ =\$(nullstring )
21
25
fix_platform_path = $(subst /,$(PS ) , $(1 ) )
27
31
CP =cp
28
32
TYPE =cat
29
33
PS =/
30
- Q =\ $( nullstring )
31
- coQ =^
34
+ Q =$( BACKSLASH )
35
+ coQ =
32
36
fix_platform_path =$(1 )
33
37
DEV_NULL =/dev/null
34
38
endif
35
39
36
- COMMA =,
37
- OPEN_PAREN =(
38
- CLOSE_PAREN =)
39
- quote =$(subst $(coQ ) ,$(Q )$(coQ ) , \
40
- $(subst % ,$(Q ) % , \
40
+ # Note: Windows escaping rules is very combersome
41
+ # initially I tried to use Q=^, but this depends on the context and (looks like) on Win version.
42
+ # Also expecially ugly thing is that in quoted strings the quotes the same are remain.
43
+ # Batch has special parameter expansion syntax to remove quotes,
44
+ # but many tools themselves remove quotes (unless escaped with backslash)
45
+ # So finally we've found that in our use cases we may not escaping any symbols but prepend backslashes before quotes.
46
+
47
+ quote =$(subst % ,$(Q ) % , \
41
48
$(subst &,$(Q ) &, \
42
49
$(subst <,$(Q ) <, \
43
50
$(subst >,$(Q ) >, \
@@ -48,9 +55,9 @@ quote=$(subst $(coQ),$(Q)$(coQ), \
48
55
$(subst $(OPEN_PAREN ) ,$(Q )$(OPEN_PAREN ) , \
49
56
$(subst $(CLOSE_PAREN ) ,$(Q )$(CLOSE_PAREN ) , \
50
57
$(subst !,$(Q ) !, \
51
- $(subst ",$(Q ) ", \
58
+ $(subst ",$(BACKSLASH ) ", \
52
59
$(subst $(Q ) ,$(Q )$(Q ) , \
53
- $(1 ) ) ) ) ) ) ) ) ) ) ) ) ) ) )
60
+ $(1 ) ) ) ) ) ) ) ) ) ) ) ) ) )
54
61
55
62
56
63
# =============================================================
@@ -118,15 +125,15 @@ ifeq ($(TOOLCHAIN),mwdt)
118
125
LD = ccac
119
126
AR = arac
120
127
AS = ccac
121
- CFLAGS += -tcf=$(TCF_FILE ) -tcf_core_config
128
+ TCF_CFLAGS += -tcf=$(TCF_FILE ) -tcf_core_config
122
129
LDFLAGS += -tcf=$(TCF_FILE ) $(LCF )
123
130
else
124
131
CC = arc-elf32-gcc
125
132
LD = arc-elf32-ld
126
133
AR = arc-elf32-ar
127
134
AS = arc-elf32-as
128
135
CFLAGS += $(addprefix -I, $(HEADER_DIRS ) )
129
- CFLAGS += -D_Interrupt=__attribute__((interrupt(\ "ilink\ ")))
136
+ CFLAGS += -D_Interrupt=__attribute__((interrupt("ilink")))
130
137
CFLAGS += -D_lr=__builtin_arc_lr
131
138
CFLAGS += -D_sr=__builtin_arc_sr
132
139
CFLAGS += -D_seti=__builtin_arc_seti
152
159
endif
153
160
endif
154
161
155
- CFLAGS := $(call quote, $(CFLAGS ) )
162
+ # TCF file needs to be the in front of the other CFLAGS
163
+ CFLAGS := $(TCF_CFLAGS ) $(call quote, $(CFLAGS ) )
156
164
LDFLAGS := $(call quote, $(LDFLAGS ) )
157
165
158
166
vpath % .c $(SRC_DIRS )
@@ -216,6 +224,9 @@ endif
216
224
ifneq ($(CPP_DEPENDS ) ,)
217
225
-include $(CPP_DEPENDS )
218
226
endif
227
+ ifneq ($(CC_DEPENDS ) ,)
228
+ -include $(CC_DEPENDS )
229
+ endif
219
230
220
231
# =================================================================
221
232
# Applications rules
0 commit comments