-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
38 lines (28 loc) · 753 Bytes
/
Makefile
File metadata and controls
38 lines (28 loc) · 753 Bytes
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
CFLAGS = -std=c99 -Wall -Wno-unused-function -Wno-unused-variable -Werror -Wpointer-arith -Wfatal-errors
DEBUG = -g
# disable default suffixes
.SUFFIXES:
SOURCES = headify.c util.c
DEPENDENCIES = $(SOURCES:.c=.d)
OBJECTS = $(SOURCES:.c=.o)
# pattern rule for compiling .c-file to executable
%: %.o util.o
gcc $(CFLAGS) $(DEBUG) $< util.o -lm -o $@
headify: $(OBJECTS)
gcc $(CFLAGS) $(DEBUG) $(OBJECTS) -lm -o $@
%.c %.h: %.d.c
./headify $< > $@
%.o: %.c
gcc -c $(CFLAGS) $(DEBUG) $<
%.d: %.c
@echo "$@ \\" >$@; \
gcc -MM $(CFLAGS) $(DEBUG) $< >>$@
include $(DEPENDENCIES)
# do not treat "clean" as a file name
.PHONY: clean
# remove produced files, invoke as "make clean"
clean:
rm -f *.o
rm -f *.d
rm -rf .DS_Store
rm -rf *.dSYM