-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
41 lines (32 loc) · 860 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
CFLAGS = -Wall -pedantic -Werror
LFLAGS = `sdl-config --libs` -lSDL -lSDL_image -lSDL_ttf -lSDL_mixer
#OBJS = main.o
prog = "build/gamey"
CC = gcc
sources = $(wildcard src/*.c)
objects = $(patsubst %.c,%.o,$(sources))
builds = $(patsubst src/%.o,build/%.o,$(objects))
includes = $(wildcard include/*.h)
all: $(prog)
rm build/*
touch build/unloved
# target, uses rules
$(prog): $(builds) $(include)
echo "Objects: ${builds}"
$(CC) ${builds} -o ${prog} $(LFLAGS)
cp build/gamey gamey
# src/main.c
# rule for building objects
build/%.o : src/%.c
$(CC) -I./include -c $^ -o $@
# clean up the program
clean :
rm build/*
#rm gamey
build : $(builds) $(include)
# build only
echo "Objects: ${builds}"
$(CC) $(LFLAGS) ${builds} -o ${prog}
cp build/gamey gamey
# here I would like to clean and then build since we getting subtle errors
super :