-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
39 lines (32 loc) · 849 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
CC=gcc
CFLAGS=-Iincludes -Wall -Wextra -Wformat -std=c99 -pedantic
SRCDIR=src
OBJDIR=target
OBJS=$(OBJDIR)/core/scanner.o \
$(OBJDIR)/core/token.o \
$(OBJDIR)/utils.o
TESTS=test/core/token_test.c \
test/core/scanner_test.c
$(OBJDIR)/%.o : $(SRCDIR)/%.c includes/%.h
$(CC) $(CFLAGS) -c $< -o $@
# make dir to store the .o files, if it doesn't already exist
makeTargetDir:
mkdir -p $(OBJDIR)
mkdir -p $(OBJDIR)/core
compile: makeTargetDir $(OBJS)
# create test result dir, if needed
makeTestDir:
mkdir -p test-results
# compile AND run the unit tests
test: compile makeTestDir
$(CC) $(CFLAGS) test/runner.c test/test.c $(TESTS) $(OBJS) -o tests
./tests
# remove everything, if they exist
clean:
-rm -f $(OBJDIR)/*.o
-rm -f $(OBJDIR)/*/*.o
-rm -f tests
# create the doxygen HTML documentation
docs:
mkdir -p doc
doxygen Doxyfile