2024-02-15 14:18:37 +00:00
|
|
|
TARGET ?= build/rts_game
|
|
|
|
SRC_DIRS ?= ./src
|
2024-02-15 13:53:51 +00:00
|
|
|
|
2024-02-15 14:18:37 +00:00
|
|
|
SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s)
|
|
|
|
OBJS := $(addsuffix .o,$(basename $(SRCS)))
|
2024-02-15 13:53:51 +00:00
|
|
|
DEPS := $(OBJS:.o=.d)
|
|
|
|
|
|
|
|
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
|
|
|
|
INC_FLAGS := $(addprefix -I,$(INC_DIRS))
|
|
|
|
|
2024-02-15 14:18:37 +00:00
|
|
|
CPPFLAGS ?= $(INC_FLAGS) -MMD -MP
|
2024-02-15 13:53:51 +00:00
|
|
|
|
2024-02-15 14:18:37 +00:00
|
|
|
$(TARGET): $(OBJS)
|
|
|
|
$(CC) $(LDFLAGS) $(OBJS) -o $@ $(LOADLIBES) $(LDLIBS) -lSDL2
|
2024-02-15 13:53:51 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
clean:
|
2024-02-15 14:18:37 +00:00
|
|
|
$(RM) $(TARGET) $(OBJS) $(DEPS)
|
2024-02-15 13:53:51 +00:00
|
|
|
|
2024-02-15 14:18:37 +00:00
|
|
|
-include $(DEPS)
|