-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile.mingw
45 lines (34 loc) · 974 Bytes
/
Makefile.mingw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
.PHONY: all clean purge
PROJECT = yatka.exe
SRC = src/main.c src/data_persistence.c src/video.c src/sound.c \
src/state_gameover.c src/state_settings.c src/randomizer.c \
src/state_mainmenu.c src/skin.c
OBJ = $(SRC:.c=.o)
DEP = $(SRC:.c=.d)
COMMIT_HASH != git tag --points-at HEAD
ifeq ($(COMMIT_HASH), )
COMMIT_HASH != git rev-parse --short=7 HEAD
endif
$(shell git diff-index --quiet HEAD)
ifneq ($(.SHELLSTATUS),0)
COMMIT_HASH := $(COMMIT_HASH)_dirty
endif
CFLAGS = -std=c99 -g -Iinc -DDEV -DCOMMIT_HASH=$(COMMIT_HASH)
LDFLAGS = -lmingw32 -lSDLmain -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer
CC = gcc
all: $(PROJECT)
$(PROJECT): $(OBJ)
$(CC) -o $(PROJECT) $(OBJ) $(LDFLAGS)
src/%.o: src/%.c
$(CC) $(CFLAGS) -c -o $@ $<
src/%.d: src/%.c
@set -e; \
rm -f $@; \
$(CC) -MM $(CFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,src/\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
clean:
rm -rf $(PROJECT) $(OBJ) src/*.d.*
purge: clean
rm -rf $(DEP)
-include $(DEP)