From 6da35ff25d01450abde5817118463224126cfbbe Mon Sep 17 00:00:00 2001 From: /jedi/ Date: Sun, 28 Oct 2018 14:00:38 +0100 Subject: [PATCH] clean up Makefiles --- OBJECTS | 5 +++++ avr.Makefile | 6 ++---- linux.Makefile | 10 +++------- 3 files changed, 10 insertions(+), 11 deletions(-) create mode 100644 OBJECTS diff --git a/OBJECTS b/OBJECTS new file mode 100644 index 0000000..23bfc66 --- /dev/null +++ b/OBJECTS @@ -0,0 +1,5 @@ +TARGET = main +SRC = col.cpp hal.cpp main.cpp example.cpp + +SRCDIR = src +INCDIR = inc diff --git a/avr.Makefile b/avr.Makefile index e88adf6..211e4e7 100644 --- a/avr.Makefile +++ b/avr.Makefile @@ -1,3 +1,5 @@ +include OBJECTS + #==== Main Options ============================================================= MCU = atmega328p @@ -5,11 +7,7 @@ F_CPU = 16000000 LFUSE = 0xf1 HFUSE = 0xdf -TARGET = main -SRC = col.cpp hal.cpp main.cpp -SRCDIR = src -INCDIR = inc OBJDIR = build/avr BACKUPDIR = backup diff --git a/linux.Makefile b/linux.Makefile index cbf6f30..ca62658 100644 --- a/linux.Makefile +++ b/linux.Makefile @@ -1,10 +1,5 @@ +include OBJECTS -TARGET = main - -SRC = col.cpp hal.cpp main.cpp - -SRCDIR = src -INCDIR = inc OBJDIR = build/linux SRC_PATH = $(SRC:%=$(SRCDIR)/%) @@ -18,6 +13,7 @@ CXXFLAGS += -std=c++17 CFLAGS += -I$(INCDIR) -DLINUX CXXFLAGS += -I$(INCDIR) -DLINUX +LDFLAGS += -lSDL2 linux: $(OBJDIR)/$(TARGET) @@ -28,7 +24,7 @@ all: $(OBJDIR)/$(TARGET) .PRECIOUS: $(OBJ) $(OBJDIR)/$(TARGET): $(OBJ) | $(OBJDIR) @echo link $^ - @$(CXX) -o $@ $^ + @$(CXX) $(LDFLAGS) -o $@ $^ $(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR) @echo compile $<