-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
31 lines (25 loc) · 827 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
CC=cc
LFLAGS=-Wall -ansi -Wpedantic -Wextra -O $(DEBUG)
CFLAGS=-c $(LFLAGS)
DEBUG=-g
SOURCES=readline.c token.c parse.c tree.c env.c eval.c sexpr.c
OBJECTS=$(SOURCES:.c=.o)
HEADERS=$(SOURCES:.c=.h)
MAINSOURCES=main.c $(SOURCES) $(HEADERS)
TESTSOURCES=test.c $(SOURCES) $(HEADERS)
MAINOBJECTS=$(MAINSOURCES:.c=.o)
EXECUTABLE=clasp
TEST=test
all: $(MAINSOURCES) $(EXECUTABLE) $(TEST)
clean:
rm *.o $(EXECUTABLE) $(TEST) *.exe *.exe.stackdump
#used splint, kind of useless, crashed on /usr/include/ctype.h (don't know why it was looking at that)
#lint: $(SOURCES) $(HEADERS)
# splint $(SOURCES) $(HEADERS)
$(TEST): $(TEST).o $(OBJECTS) $(TESTSOURCES)
$(CC) $(LFLAGS) -o $(TEST) $(TEST).o $(OBJECTS)
.SUFFIXES: .o .c
.c.o:
$(CC) $(CFLAGS) $<
$(EXECUTABLE): $(MAINOBJECTS) $(HEADERS)
$(CC) $(LFLAGS) $(MAINOBJECTS) -o $@