mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-18 12:52:44 +01:00
Merge pull request #1571 from Kijewski/make-mkdir-once
make: cleanup Makefile.base
This commit is contained in:
commit
d76ac6ed9f
@ -22,49 +22,49 @@ ${DIRS:%=ALL--%}:
|
||||
${DIRS:%=CLEAN--%}:
|
||||
"$(MAKE)" -C ${@:CLEAN--%=%} clean
|
||||
|
||||
ASMSRC = $(wildcard *.s)
|
||||
ASSMSRC = $(wildcard *.S)
|
||||
ASMOBJ = $(ASMSRC:%.s=$(BINDIR)$(MODULE)/%.o)
|
||||
ASMOBJ += $(ASSMSRC:%.S=$(BINDIR)$(MODULE)/%.o)
|
||||
|
||||
ifeq ($(strip $(SRC)),)
|
||||
SRC = $(wildcard *.c)
|
||||
SRC := $(wildcard *.c)
|
||||
endif
|
||||
|
||||
ifeq ($(strip $(SRCXX)),)
|
||||
SRCXX = $(wildcard *.cpp)
|
||||
SRCXX := $(wildcard *.cpp)
|
||||
endif
|
||||
ifeq ($(strip $(ASMSRC)),)
|
||||
ASMSRC := $(wildcard *.s)
|
||||
endif
|
||||
ifeq ($(strip $(ASSMSRC)),)
|
||||
ASSMSRC := $(wildcard *.S)
|
||||
endif
|
||||
|
||||
OBJC = $(SRC:%.c=$(BINDIR)$(MODULE)/%.o)
|
||||
OBJCXX = $(SRCXX:%.cpp=$(BINDIR)$(MODULE)/%.o)
|
||||
OBJC := $(SRC:%.c=$(BINDIR)$(MODULE)/%.o)
|
||||
OBJCXX := $(SRCXX:%.cpp=$(BINDIR)$(MODULE)/%.o)
|
||||
ASMOBJ := $(ASMSRC:%.s=$(BINDIR)$(MODULE)/%.o)
|
||||
ASSMOBJ := $(ASSMSRC:%.S=$(BINDIR)$(MODULE)/%.o)
|
||||
|
||||
OBJ = $(OBJC)
|
||||
OBJ += $(OBJCXX)
|
||||
OBJ := $(OBJC) $(OBJCXX) $(ASMOBJ) $(ASSMOBJ)
|
||||
DEP := $(OBJC:.o=.d) $(OBJCXX:.o=.d) $(ASSMOBJ:.o=.d)
|
||||
|
||||
DEP = $(SRC:%.c=$(BINDIR)$(MODULE)/%.d)
|
||||
DEP += $(SRCXX:%.cpp=$(BINDIR)$(MODULE)/%.d)
|
||||
$(BINDIR)$(MODULE)/:
|
||||
$(AD)mkdir -p $@
|
||||
|
||||
$(BINDIR)$(MODULE).a: $(OBJ) $(ASMOBJ) ${DIRS:%=ALL--%}
|
||||
@mkdir -p $(BINDIR)$(MODULE)
|
||||
$(AD)$(AR) -rc $(BINDIR)$(MODULE).a $(OBJ) $(ASMOBJ)
|
||||
$(BINDIR)$(MODULE).a: $(OBJ) ${DIRS:%=ALL--%} $(BINDIR)$(MODULE)/
|
||||
$(AD)$(AR) -rcs $@ $(OBJ)
|
||||
|
||||
CXXFLAGS = $(filter-out $(CXXUWFLAGS), $(CFLAGS)) $(CXXEXFLAGS)
|
||||
|
||||
# compile and generate dependency info
|
||||
|
||||
$(OBJC): $(BINDIR)$(MODULE)/%.o: %.c $(BINDIR)$(MODULE)/
|
||||
$(AD)$(CC) $(CFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)
|
||||
|
||||
$(OBJCXX): $(BINDIR)$(MODULE)/%.o: %.cpp $(BINDIR)$(MODULE)/
|
||||
$(AD)$(CXX) $(CXXFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)
|
||||
|
||||
$(ASMOBJ): $(BINDIR)$(MODULE)/%.o: %.s $(BINDIR)$(MODULE)/
|
||||
$(AD)$(AS) $(ASFLAGS) -o $@ $(abspath $<)
|
||||
|
||||
$(ASSMOBJ): $(BINDIR)$(MODULE)/%.o: %.S $(BINDIR)$(MODULE)/
|
||||
$(AD)$(CC) $(CFLAGS) $(INCLUDES) -MD -MP -c -o $@ $(abspath $<)
|
||||
|
||||
# pull in dependency info for *existing* .o files
|
||||
# deleted header files will be silently ignored
|
||||
-include $(OBJ:.o=.d)
|
||||
|
||||
# compile and generate dependency info
|
||||
$(BINDIR)$(MODULE)/%.o: %.c
|
||||
@mkdir -p $(BINDIR)$(MODULE)
|
||||
$(AD)$(CC) $(CFLAGS) $(INCLUDES) -MD -MP -c -o $(BINDIR)$(MODULE)/$*.o $(abspath $*.c)
|
||||
|
||||
$(BINDIR)$(MODULE)/%.o: %.cpp
|
||||
@mkdir -p $(BINDIR)$(MODULE)
|
||||
$(AD)$(CXX) $(filter-out $(CXXUWFLAGS), $(CFLAGS)) $(CXXEXFLAGS) $(INCLUDES) -MD -MP -c -o $(BINDIR)$(MODULE)/$*.o $(abspath $*.cpp)
|
||||
|
||||
$(BINDIR)$(MODULE)/%.o: %.s
|
||||
@mkdir -p $(BINDIR)$(MODULE)
|
||||
$(AD)$(AS) $(ASFLAGS) $*.s -o $(BINDIR)$(MODULE)/$*.o
|
||||
|
||||
$(BINDIR)$(MODULE)/%.o: %.S
|
||||
@mkdir -p $(BINDIR)$(MODULE)
|
||||
$(AD)$(CC) $(CFLAGS) $(INCLUDES) -MD -MP -c -o $(BINDIR)$(MODULE)/$*.o $(abspath $*.S)
|
||||
-include $(DEP)
|
||||
|
Loading…
Reference in New Issue
Block a user