micromenu/linux.Makefile

43 lines
723 B
Text
Raw Normal View History

2018-10-28 13:00:38 +00:00
include OBJECTS
2018-10-19 11:16:47 +00:00
OBJDIR = build/linux
SRC_PATH = $(SRC:%=$(SRCDIR)/%)
OBJ = $(SRC_PATH:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
2018-10-25 14:21:57 +00:00
REMOVEDIR = rm -rf
2018-10-19 11:16:47 +00:00
CFLAGS += -std=gnu99
CXXFLAGS += -std=c++17
CFLAGS += -I$(INCDIR) -DLINUX
CXXFLAGS += -I$(INCDIR) -DLINUX
2018-10-28 13:00:38 +00:00
LDFLAGS += -lSDL2
2018-10-19 11:16:47 +00:00
linux: $(OBJDIR)/$(TARGET)
all: $(OBJDIR)/$(TARGET)
.SECONDARY: $(TARGET)
.PRECIOUS: $(OBJ)
$(OBJDIR)/$(TARGET): $(OBJ) | $(OBJDIR)
2018-10-25 14:21:57 +00:00
@echo link $^
2018-10-28 13:00:38 +00:00
@$(CXX) $(LDFLAGS) -o $@ $^
2018-10-19 11:16:47 +00:00
$(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)
2018-10-25 14:21:57 +00:00
clean:
@$(REMOVEDIR) "$(OBJDIR)"
@echo clean $(OBJDIR)