micromenu/linux.Makefile
2018-11-01 19:39:19 +01:00

44 lines
765 B
Makefile

include OBJECTS
OBJDIR = build/linux
SRC_PATH = $(SRC:%=$(SRCDIR)/%)
OBJ = $(SRC_PATH:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
REMOVEDIR = rm -rf
CFLAGS += -std=gnu99
CXXFLAGS += -std=c++17
CFLAGS += -I$(INCDIR) -DLINUX
CXXFLAGS += -I$(INCDIR) -DLINUX
LDFLAGS += -lSDL2
linux: $(OBJDIR)/$(TARGET)
all: $(OBJDIR)/$(TARGET)
.SECONDARY: $(TARGET)
.PRECIOUS: $(OBJ)
$(OBJDIR)/$(TARGET): $(OBJ) | $(OBJDIR)
@echo link $^
@$(CXX) $(LDFLAGS) -o $@ $^
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
@echo compile $<
@mkdir -p $(dir $@)
@$(CC) -c $(CFLAGS) $< -o $@
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp | $(OBJDIR)
@echo compile $<
@mkdir -p $(dir $@)
@$(CXX) -c $(CXXFLAGS) $< -o $@
$(OBJDIR):
mkdir -p $(OBJDIR)
clean:
@$(REMOVEDIR) "$(OBJDIR)"
@echo clean $(OBJDIR)