rjw | 1f88458 | 2022-01-06 17:20:42 +0800 | [diff] [blame^] | 1 | |
| 2 | # create a separate list of objects per source type |
| 3 | MODULE_CSRCS := $(filter %.c,$(MODULE_SRCS)) |
| 4 | MODULE_CPPSRCS := $(filter %.cpp,$(MODULE_SRCS)) |
| 5 | MODULE_ASMSRCS := $(filter %.S,$(MODULE_SRCS)) |
| 6 | |
| 7 | MODULE_COBJS := $(call TOBUILDDIR,$(patsubst %.c,%.o,$(MODULE_CSRCS))) |
| 8 | MODULE_CPPOBJS := $(call TOBUILDDIR,$(patsubst %.cpp,%.o,$(MODULE_CPPSRCS))) |
| 9 | MODULE_ASMOBJS := $(call TOBUILDDIR,$(patsubst %.S,%.o,$(MODULE_ASMSRCS))) |
| 10 | |
| 11 | # do the same thing for files specified in arm override mode |
| 12 | MODULE_ARM_CSRCS := $(filter %.c,$(MODULE_ARM_OVERRIDE_SRCS)) |
| 13 | MODULE_ARM_CPPSRCS := $(filter %.cpp,$(MODULE_ARM_OVERRIDE_SRCS)) |
| 14 | MODULE_ARM_ASMSRCS := $(filter %.S,$(MODULE_ARM_OVERRIDE_SRCS)) |
| 15 | |
| 16 | MODULE_ARM_COBJS := $(call TOBUILDDIR,$(patsubst %.c,%.o,$(MODULE_ARM_CSRCS))) |
| 17 | MODULE_ARM_CPPOBJS := $(call TOBUILDDIR,$(patsubst %.cpp,%.o,$(MODULE_ARM_CPPSRCS))) |
| 18 | MODULE_ARM_ASMOBJS := $(call TOBUILDDIR,$(patsubst %.S,%.o,$(MODULE_ARM_ASMSRCS))) |
| 19 | |
| 20 | MODULE_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 |
| 72 | MODULE_CSRCS := |
| 73 | MODULE_CPPSRCS := |
| 74 | MODULE_ASMSRCS := |
| 75 | MODULE_COBJS := |
| 76 | MODULE_CPPOBJS := |
| 77 | MODULE_ASMOBJS := |
| 78 | |
| 79 | # MODULE_OBJS is passed back |
| 80 | #MODULE_OBJS := |
| 81 | |