aboutsummaryrefslogtreecommitdiff
path: root/utils/Makefile
blob: bfd55de25dee8d3dd26d8d910ce0a5c300f19744 (plain) (blame)
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
target := math
objs   := math.o

CC     := gcc
CFLAGS := -O3 -std=c99 -pedantic -Wall -Wextra -Wmissing-prototypes -Wstrict-prototypes -Wno-unused-result

all: $(target)

###
# Automatic dependency tracking
#
deps := $(patsubst %.o,%.d,$(objs))
-include $(deps)
DEPFLAGS = -MMD -MF $(@:.o=.d)

###
# Compile the program
#
$(target): $(objs)
	$(CC) $(CFLAGS) -o $@ $^

%.o: src/%.c
	$(CC) $(CFLAGS) -c $< $(DEPFLAGS)

###
# Phony targets
#
.PHONY: clean
clean:
	rm -f $(target) $(objs) $(deps)