blob: c2c987881ffc7e557ecdb7b0022c3f02bb2d8662 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001
2# create a separate list of objects per source type
3MODULE_CSRCS := $(filter %.c,$(MODULE_SRCS))
4MODULE_CPPSRCS := $(filter %.cpp,$(MODULE_SRCS))
5MODULE_ASMSRCS := $(filter %.S,$(MODULE_SRCS))
6
7MODULE_COBJS := $(call TOBUILDDIR,$(patsubst %.c,%.o,$(MODULE_CSRCS)))
8MODULE_CPPOBJS := $(call TOBUILDDIR,$(patsubst %.cpp,%.o,$(MODULE_CPPSRCS)))
9MODULE_ASMOBJS := $(call TOBUILDDIR,$(patsubst %.S,%.o,$(MODULE_ASMSRCS)))
10
11# do the same thing for files specified in arm override mode
12MODULE_ARM_CSRCS := $(filter %.c,$(MODULE_ARM_OVERRIDE_SRCS))
13MODULE_ARM_CPPSRCS := $(filter %.cpp,$(MODULE_ARM_OVERRIDE_SRCS))
14MODULE_ARM_ASMSRCS := $(filter %.S,$(MODULE_ARM_OVERRIDE_SRCS))
15
16MODULE_ARM_COBJS := $(call TOBUILDDIR,$(patsubst %.c,%.o,$(MODULE_ARM_CSRCS)))
17MODULE_ARM_CPPOBJS := $(call TOBUILDDIR,$(patsubst %.cpp,%.o,$(MODULE_ARM_CPPSRCS)))
18MODULE_ARM_ASMOBJS := $(call TOBUILDDIR,$(patsubst %.S,%.o,$(MODULE_ARM_ASMSRCS)))
19
20MODULE_OBJS := $(MODULE_COBJS) $(MODULE_CPPOBJS) $(MODULE_ASMOBJS) $(MODULE_ARM_COBJS) $(MODULE_ARM_CPPOBJS) $(MODULE_ARM_ASMOBJS)
21
22#$(info MODULE_SRCS = $(MODULE_SRCS))
23#$(info MODULE_CSRCS = $(MODULE_CSRCS))
24#$(info MODULE_CPPSRCS = $(MODULE_CPPSRCS))
25#$(info MODULE_ASMSRCS = $(MODULE_ASMSRCS))
26
27#$(info MODULE_OBJS = $(MODULE_OBJS))
28#$(info MODULE_COBJS = $(MODULE_COBJS))
29#$(info MODULE_CPPOBJS = $(MODULE_CPPOBJS))
30#$(info MODULE_ASMOBJS = $(MODULE_ASMOBJS))
31
32$(MODULE_OBJS): MODULE_OPTFLAGS:=$(MODULE_OPTFLAGS)
33$(MODULE_OBJS): MODULE_COMPILEFLAGS:=$(MODULE_COMPILEFLAGS)
34$(MODULE_OBJS): MODULE_CFLAGS:=$(MODULE_CFLAGS)
35$(MODULE_OBJS): MODULE_CPPFLAGS:=$(MODULE_CPPFLAGS)
36$(MODULE_OBJS): MODULE_ASMFLAGS:=$(MODULE_ASMFLAGS)
37$(MODULE_OBJS): MODULE_SRCDEPS:=$(MODULE_SRCDEPS)
38$(MODULE_OBJS): MODULE_INCLUDES:=$(MODULE_INCLUDES)
39
40$(MODULE_COBJS): $(BUILDDIR)/%.o: %.c $(MODULE_SRCDEPS)
41 @$(MKDIR)
42 @echo compiling $<
43 $(NOECHO)$(CC) $(GLOBAL_OPTFLAGS) $(MODULE_OPTFLAGS) $(GLOBAL_COMPILEFLAGS) $(ARCH_COMPILEFLAGS) $(MODULE_COMPILEFLAGS) $(GLOBAL_CFLAGS) $(ARCH_CFLAGS) $(MODULE_CFLAGS) $(THUMBCFLAGS) $(GLOBAL_INCLUDES) $(MODULE_INCLUDES) -c $< -MD -MP -MT $@ -MF $(@:%o=%d) -o $@
44
45$(MODULE_CPPOBJS): $(BUILDDIR)/%.o: %.cpp $(MODULE_SRCDEPS)
46 @$(MKDIR)
47 @echo compiling $<
48 $(NOECHO)$(CC) $(GLOBAL_OPTFLAGS) $(MODULE_OPTFLAGS) $(GLOBAL_COMPILEFLAGS) $(ARCH_COMPILEFLAGS) $(MODULE_COMPILEFLAGS) $(GLOBAL_CPPFLAGS) $(ARCH_CPPFLAGS) $(MODULE_CPPFLAGS) $(THUMBCFLAGS) $(GLOBAL_INCLUDES) $(MODULE_INCLUDES) -c $< -MD -MP -MT $@ -MF $(@:%o=%d) -o $@
49
50$(MODULE_ASMOBJS): $(BUILDDIR)/%.o: %.S $(MODULE_SRCDEPS)
51 @$(MKDIR)
52 @echo compiling $<
53 $(NOECHO)$(CC) $(GLOBAL_OPTFLAGS) $(MODULE_OPTFLAGS) $(GLOBAL_COMPILEFLAGS) $(ARCH_COMPILEFLAGS) $(MODULE_COMPILEFLAGS) $(GLOBAL_ASMFLAGS) $(ARCH_ASMFLAGS) $(MODULE_ASMFLAGS) $(THUMBCFLAGS) $(GLOBAL_INCLUDES) $(MODULE_INCLUDES) -c $< -MD -MP -MT $@ -MF $(@:%o=%d) -o $@
54
55# overridden arm versions
56$(MODULE_ARM_COBJS): $(BUILDDIR)/%.o: %.c $(MODULE_SRCDEPS)
57 @$(MKDIR)
58 @echo compiling $<
59 $(NOECHO)$(CC) $(GLOBAL_OPTFLAGS) $(MODULE_OPTFLAGS) $(GLOBAL_COMPILEFLAGS) $(ARCH_COMPILEFLAGS) $(MODULE_COMPILEFLAGS) $(GLOBAL_CFLAGS) $(ARCH_CFLAGS) $(MODULE_CFLAGS) $(GLOBAL_INCLUDES) $(MODULE_INCLUDES) -c $< -MD -MP -MT $@ -MF $(@:%o=%d) -o $@
60
61$(MODULE_ARM_CPPOBJS): $(BUILDDIR)/%.o: %.cpp $(MODULE_SRCDEPS)
62 @$(MKDIR)
63 @echo compiling $<
64 $(NOECHO)$(CC) $(GLOBAL_OPTFLAGS) $(MODULE_OPTFLAGS) $(GLOBAL_COMPILEFLAGS) $(ARCH_COMPILEFLAGS) $(MODULE_COMPILEFLAGS) $(GLOBAL_CPPFLAGS) $(ARCH_CPPFLAGS) $(MODULE_CPPFLAGS) $(GLOBAL_INCLUDES) $(MODULE_INCLUDES) -c $< -MD -MP -MT $@ -MF $(@:%o=%d) -o $@
65
66$(MODULE_ARM_ASMOBJS): $(BUILDDIR)/%.o: %.S $(MODULE_SRCDEPS)
67 @$(MKDIR)
68 @echo compiling $<
69 $(NOECHO)$(CC) $(GLOBAL_OPTFLAGS) $(MODULE_OPTFLAGS) $(GLOBAL_COMPILEFLAGS) $(ARCH_COMPILEFLAGS) $(MODULE_COMPILEFLAGS) $(GLOBAL_ASMFLAGS) $(ARCH_ASMFLAGS) $(MODULE_ASMFLAGS) $(GLOBAL_INCLUDES) $(MODULE_INCLUDES) -c $< -MD -MP -MT $@ -MF $(@:%o=%d) -o $@
70
71# clear some variables we set here
72MODULE_CSRCS :=
73MODULE_CPPSRCS :=
74MODULE_ASMSRCS :=
75MODULE_COBJS :=
76MODULE_CPPOBJS :=
77MODULE_ASMOBJS :=
78
79# MODULE_OBJS is passed back
80#MODULE_OBJS :=
81