-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
59 lines (45 loc) · 1017 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# Makefile for JSex Test tool
# by Vikman
# April 29, 2017
#
# Syntax: make [ DEBUG=1 [ NODEBUG_LEXER=1 ] [ NODEBUG_PARSER=1 ] [ NODEBUG_RT=1 ]] [ PROFILE=1 ] [ COVERAGE=1 ] [ all | clean ]
SRC = src
INC = include
CC = gcc
RM = rm -f
CFLAGS = -pipe -Wall -I$(INC)
LIBS = -lm
TARGET = jsex
SOURCES = $(wildcard src/*.c)
HEADERS = $(wildcard include/*.h)
OBJECTS = $(SOURCES:.c=.o)
GCNO = $(SOURCES:.c=.gcno)
GCDA = $(SOURCES:.c=.gcda)
ifeq ($(DEBUG), 1)
CFLAGS += -g -Wextra -DDEBUG
else
CFLAGS += -O2
endif
ifeq ($(NODEBUG_LEXER), 1)
CFLAGS += -DNODEBUG_LEXER
endif
ifeq ($(NODEBUG_PARSER), 1)
CFLAGS += -DNODEBUG_PARSER
endif
ifeq ($(NODEBUG_RT), 1)
CFLAGS += -DNODEBUG_RT
endif
ifeq ($(PROFILE), 1)
CFLAGS += -DPROFILE
endif
ifeq ($(COVERAGE), 1)
CFLAGS += --coverage -g
endif
.PHONY: all clean
%.o: $(SRC)/%.c $(INC)/*.h
$(CC) $(CFLAGS) -c -o $@ $<
all: $(TARGET)
clean:
$(RM) $(TARGET) $(OBJECTS) $(GCNO) $(GCDA) $(wildcard *.c.gcov)
$(TARGET): $(OBJECTS)
$(CC) $(CFLAGS) -o $@ $^ $(LIBS)