micromenu/linux.Makefile

50 lines
867 B
Text
Raw Permalink 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
2021-02-24 19:37:27 +00:00
CXXFLAGS += -std=gnu++20
LDFLAGS =
2018-10-19 11:16:47 +00:00
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 $^
2021-02-24 19:37:27 +00:00
$(CXX) $(CXXFLAGS) -o $@ $^ $(LDFLAGS)
2018-10-19 11:16:47 +00:00
$(OBJDIR)/%.o: $(SRCDIR)/%.c | $(OBJDIR)
@echo compile $<
2018-11-01 18:39:19 +00:00
@mkdir -p $(dir $@)
2018-10-19 11:16:47 +00:00
@$(CC) -c $(CFLAGS) $< -o $@
$(OBJDIR)/%.o: $(SRCDIR)/%.cpp | $(OBJDIR)
@echo compile $<
2018-11-01 18:39:19 +00:00
@mkdir -p $(dir $@)
2018-10-19 11:16:47 +00:00
@$(CXX) -c $(CXXFLAGS) $< -o $@
$(OBJDIR):
mkdir -p $(OBJDIR)
2018-10-25 14:21:57 +00:00
clean:
@$(REMOVEDIR) "$(OBJDIR)"
@echo clean $(OBJDIR)
2018-11-08 13:37:35 +00:00
run: $(OBJDIR)/$(TARGET)
@echo run $(OBJDIR)/$(TARGET)
@$(OBJDIR)/$(TARGET)