2023-10-30 15:50:12 +03:00
|
|
|
include config.mk
|
2023-10-30 03:00:39 +03:00
|
|
|
|
2023-10-30 15:50:12 +03:00
|
|
|
INCLUDE = -Iinclude
|
2023-10-29 20:03:23 +03:00
|
|
|
RM = rm -f
|
|
|
|
SRCDIR = src
|
|
|
|
OBJDIR = obj
|
2023-12-17 03:07:48 +03:00
|
|
|
SRC = main.c screen.c input.c player.c sleep.c platform/getch.c platform/game.c
|
2023-10-29 20:03:23 +03:00
|
|
|
OBJ = $(addprefix $(OBJDIR)/,$(SRC:.c=.o))
|
|
|
|
|
2024-02-23 17:11:50 +03:00
|
|
|
# Link pthread on FreeBSD
|
|
|
|
DEFLDFLAGS += $(shell if echo "" | cc -E -dM -xc - | grep __FreeBSD__ > /dev/null 2>&1; then echo "-lpthread"; fi)
|
|
|
|
# Use ucrt on MinGW
|
|
|
|
DEFLDFLAGS += $(shell if echo "" | cc -E -dM -xc - | grep __MINGW32__ > /dev/null 2>&1; then echo "-lucrt"; fi)
|
|
|
|
DEFCFLAGS += $(shell if echo "" | cc -E -dM -xc - | grep __MINGW32__ > /dev/null 2>&1; then echo "-D_UCRT"; fi)
|
2023-11-25 20:55:57 +03:00
|
|
|
|
2023-11-25 00:55:36 +03:00
|
|
|
all: $(OUT)
|
2023-10-29 20:03:23 +03:00
|
|
|
|
2023-12-09 00:35:49 +03:00
|
|
|
$(OBJDIR)/platform:
|
|
|
|
mkdir -p $(OBJDIR)/platform
|
2023-12-01 22:39:38 +03:00
|
|
|
|
2023-10-29 20:03:23 +03:00
|
|
|
$(OBJDIR)/%.o: $(SRCDIR)/%.c
|
2024-02-23 17:13:02 +03:00
|
|
|
$(CC) -c -std=c11 -o $@ $< $(CFLAGS) $(DEFCFLAGS) $(INCLUDE)
|
2023-10-29 20:03:23 +03:00
|
|
|
|
2023-12-09 00:35:49 +03:00
|
|
|
$(OUT): $(OBJDIR)/platform $(OBJ)
|
2023-11-25 20:55:57 +03:00
|
|
|
$(CC) -o $@ $(OBJ) $(LDFLAGS) $(DEFLDFLAGS)
|
2023-10-29 20:03:23 +03:00
|
|
|
|
|
|
|
clean:
|
2023-12-02 12:29:29 +03:00
|
|
|
$(RM) $(OUT) $(OBJDIR)/*.o $(OBJDIR)/platform/*.o
|
2023-10-29 20:03:23 +03:00
|
|
|
|
|
|
|
.PHONY: default clean
|