clean Makefiles

This commit is contained in:
j3d1 2018-10-25 16:21:57 +02:00
parent a0cb1c1395
commit 4218c4102e
3 changed files with 16 additions and 12 deletions

View file

@ -11,3 +11,7 @@ avr:
flash:
@make -f avr.Makefile flash
clean:
@rm -r build
@echo clean all

View file

@ -171,18 +171,16 @@ $(OBJDIR)/%.lss: $(OBJDIR)/%.elf
.SECONDARY: $(TARGET).elf
.PRECIOUS: $(OBJ)
$(OBJDIR)/%.elf: $(OBJ)
$(OBJDIR)/%.elf: $(OBJ) | $(OBJDIR)
@echo link $^
@$(CXX) $(CPU) $^ -o $@ $(LDFLAGS) #-lstdc++
$(OBJDIR)/%.o: $(SRCDIR)/%.c
@$(shell mkdir -p $(OBJDIR) 2>/dev/null)
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
@echo compile $<
@$(CC) -c $(CPU) $(CFLAGS) $< -o $@
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
@$(shell mkdir -p $(OBJDIR) 2>/dev/null)
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp | $(OBJDIR)
@echo compile $<
@$(CXX) -c $(CPU) $(CXXFLAGS) $< -o $@
@ -190,15 +188,12 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.cpp
$(OBJDIR)/%.size: $(OBJDIR)/%.elf
@$(AVRSIZE) -A $< | tee $@
$(OBJDIR):
mkdir -p $(OBJDIR)
clean:
@$(REMOVE) "size"
@$(REMOVE) "$(TARGET).hex"
@$(REMOVE) "$(TARGET).eep"
@$(REMOVE) "$(TARGET).elf"
@$(REMOVE) "$(TARGET).lss"
@$(REMOVEDIR) "$(OBJDIR)"
@echo clean $(TARGET)
@echo clean $(OBJDIR)
backup:

View file

@ -10,6 +10,7 @@ OBJDIR = build/linux
SRC_PATH = $(SRC:%=$(SRCDIR)/%)
OBJ = $(SRC_PATH:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
REMOVEDIR = rm -rf
CFLAGS += -std=gnu99
CXXFLAGS += -std=c++17
@ -26,6 +27,7 @@ all: $(OBJDIR)/$(TARGET)
.SECONDARY: $(TARGET)
.PRECIOUS: $(OBJ)
$(OBJDIR)/$(TARGET): $(OBJ) | $(OBJDIR)
@echo link $^
@$(CXX) -o $@ $^
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
@ -36,6 +38,9 @@ $(OBJDIR)/%.o: $(SRCDIR)/%.cpp | $(OBJDIR)
@echo compile $<
@$(CXX) -c $(CXXFLAGS) $< -o $@
$(OBJDIR):
mkdir -p $(OBJDIR)
clean:
@$(REMOVEDIR) "$(OBJDIR)"
@echo clean $(OBJDIR)