41 lines
660 B
Makefile
41 lines
660 B
Makefile
|
|
TARGET = main
|
|
|
|
SRC = col.cpp hal.cpp main.cpp
|
|
|
|
SRCDIR = src
|
|
INCDIR = inc
|
|
OBJDIR = build/linux
|
|
|
|
SRC_PATH = $(SRC:%=$(SRCDIR)/%)
|
|
OBJ = $(SRC_PATH:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
|
|
|
|
|
|
CFLAGS += -std=gnu99
|
|
CXXFLAGS += -std=c++17
|
|
|
|
|
|
CFLAGS += -I$(INCDIR) -DLINUX
|
|
CXXFLAGS += -I$(INCDIR) -DLINUX
|
|
|
|
linux: $(OBJDIR)/$(TARGET)
|
|
|
|
all: $(OBJDIR)/$(TARGET)
|
|
|
|
|
|
.SECONDARY: $(TARGET)
|
|
.PRECIOUS: $(OBJ)
|
|
$(OBJDIR)/$(TARGET): $(OBJ) | $(OBJDIR)
|
|
@$(CXX) -o $@ $^
|
|
|
|
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
|
|
@echo compile $<
|
|
@$(CC) -c $(CFLAGS) $< -o $@
|
|
|
|
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp | $(OBJDIR)
|
|
@echo compile $<
|
|
@$(CXX) -c $(CXXFLAGS) $< -o $@
|
|
|
|
|
|
$(OBJDIR):
|
|
mkdir -p $(OBJDIR)
|