-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakefile
41 lines (33 loc) · 984 Bytes
/
makefile
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
#Sharp Fighters makefile.
NAME=SharpFighters
ARCH := $(shell getconf LONG_BIT)
CFILES := $(wildcard src/*.c)
OFILES := $(addprefix obj/,$(notdir $(CFILES:.c=.o)))
ALLEGROLIBS := $(shell allegro-config --libs)
LIBS = -L./lib -lftgl -lapeg$(ARCH) -logg -ltheora -lvorbis -lalleggl -lloadpng -lm -lGL -lGLU $(ALLEGROLIBS:alleg-4.2.2=alleg)
COMPILER = gcc
OPTIONS = -c -Wall
CFLAGS = $(shell freetype-config --cflags) $(shell allegro-config --cflags) -Iinclude
build: obj $(OFILES)
$(COMPILER) -o $(NAME) $(OFILES) $(LIBS)
obj/%.o: src/%.c
$(COMPILER) $(CFLAGS) $(OPTIONS) -o $@ $<
obj:
mkdir -p obj
clean:
rm -rf obj
rm -f $(NAME)
run: $(NAME)
./$(NAME)
$(NAME):
@if [ -f $(NAME) ]; then \
echo "Starting $(NAME) ..."; \
else \
echo "$(NAME) not found. Rebuilding..."; \
$(MAKE) build; \
fi
help:
@echo "Commands :"
@echo " build : Builds the excutable."
@echo " clean : Cleans binary files."
@echo " run : Runs the excutable, and build if not built yet."