-
Notifications
You must be signed in to change notification settings - Fork 0
/
makefile
38 lines (26 loc) · 846 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
TARGET = terminal_typist
LIBS = -lm -lpthread
CC = gcc
ifeq ($(shell test -s "/usr/share/dict/american-english" && echo yes), yes)
DICTIONARY_FILE := -DDICTIONARY_FILE=\"/usr/share/dict/american-english\"
else ifeq ($(shell test -s "/usr/share/dict/words" && echo yes), yes)
DICTIONARY_FILE := -DDICTIONARY_FILE=\"/usr/share/dict/words\"
else
$(error System dictionary file not found. Please modify the makefile to point to your file.)
endif
CFLAGS = -g3 -Wall --debug $(DICTIONARY_FILE)
.PHONY: default all clean
default: $(TARGET)
run: $(TARGET)
exec ./$(TARGET)
all: default
OBJECTS = $(patsubst %.c, %.o, $(wildcard *.c))
HEADERS = $(wildcard *.h)
%.o: %.c $(HEADERS)
$(CC) $(CFLAGS) -c $< -o $@
.PRECIOUS: $(TARGET) $(OBJECTS)
$(TARGET): $(OBJECTS)
$(CC) $(OBJECTS) -Wall $(LIBS) -o $@
clean:
-rm -f *.o
-rm -f $(TARGET)