clean up Makefiles

This commit is contained in:
j3d1 2018-10-28 14:00:38 +01:00
parent 4218c4102e
commit 6da35ff25d
3 changed files with 10 additions and 11 deletions

5
OBJECTS Normal file
View file

@ -0,0 +1,5 @@
TARGET = main
SRC = col.cpp hal.cpp main.cpp example.cpp
SRCDIR = src
INCDIR = inc

View file

@ -1,3 +1,5 @@
include OBJECTS
#==== Main Options ============================================================= #==== Main Options =============================================================
MCU = atmega328p MCU = atmega328p
@ -5,11 +7,7 @@ F_CPU = 16000000
LFUSE = 0xf1 LFUSE = 0xf1
HFUSE = 0xdf HFUSE = 0xdf
TARGET = main
SRC = col.cpp hal.cpp main.cpp
SRCDIR = src
INCDIR = inc
OBJDIR = build/avr OBJDIR = build/avr
BACKUPDIR = backup BACKUPDIR = backup

View file

@ -1,10 +1,5 @@
include OBJECTS
TARGET = main
SRC = col.cpp hal.cpp main.cpp
SRCDIR = src
INCDIR = inc
OBJDIR = build/linux OBJDIR = build/linux
SRC_PATH = $(SRC:%=$(SRCDIR)/%) SRC_PATH = $(SRC:%=$(SRCDIR)/%)
@ -18,6 +13,7 @@ CXXFLAGS += -std=c++17
CFLAGS += -I$(INCDIR) -DLINUX CFLAGS += -I$(INCDIR) -DLINUX
CXXFLAGS += -I$(INCDIR) -DLINUX CXXFLAGS += -I$(INCDIR) -DLINUX
LDFLAGS += -lSDL2
linux: $(OBJDIR)/$(TARGET) linux: $(OBJDIR)/$(TARGET)
@ -28,7 +24,7 @@ all: $(OBJDIR)/$(TARGET)
.PRECIOUS: $(OBJ) .PRECIOUS: $(OBJ)
$(OBJDIR)/$(TARGET): $(OBJ) | $(OBJDIR) $(OBJDIR)/$(TARGET): $(OBJ) | $(OBJDIR)
@echo link $^ @echo link $^
@$(CXX) -o $@ $^ @$(CXX) $(LDFLAGS) -o $@ $^
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR) $(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
@echo compile $< @echo compile $<