-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
46 lines (34 loc) · 1.02 KB
/
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
# Makefile for building synax
# (c) 2017 Sayantan, Nilangshu
CFLAGS = -Wall -Wreturn-type -Werror -std=c11
DBG_FLAGS := -g -g3 -O0 -DENABLE_DEBUG
REL_FLAGS := -O2
LDFLAGS := -lzip -lxml2
EXEC := epb_test
BUILD_DIR := build
INC_DIR := . -I/usr/include/libxml2/
SRC_DIR := src
SRCS := $(wildcard src/*.c)
OBJS := $(patsubst %.c, $(BUILD_DIR)/%.o, $(notdir $(SRCS)))
.PHONY: all release debug link clean docs clean-docs
all: $(BUILD_DIR) debug
docs:
$(info Generating documentation)
@doxygen docs/Doxyfile
clean-docs:
@if [ ! -d "./docs/html" ]; then echo "No docs exist"; else rm -r ./docs/html; fi
$(BUILD_DIR):
mkdir $(BUILD_DIR)
debug: CFLAGS += $(DBG_FLAGS)
debug: link
release: CFLAGS += $(REL_FLAGS)
release: link
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c
$(info Building objects)
$(CC) -c $< $(CFLAGS) -I$(INC_DIR) -o $@
link: $(OBJS)
$(info Linking objects)
$(CC) $(OBJS) $(CFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/$(EXEC)
clean:
@echo "Cleaning build files"
@if [ ! -d "./build/" ]; then echo "Already clean"; else rm -r ./build/; fi