-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathMakefile
69 lines (54 loc) · 1.46 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#Compilers
CC := g++ -std=c++17 -Wno-psabi
DGEN := doxygen
#The Target Binary Program
TARGET := libelma.a
#The Directories, Source, Includes, Objects, Binary and Resources
SRCDIR := ./src
INCDIR := ./include
BUILDDIR := ./build
TARGETDIR := ./lib
SRCEXT := cc
#Flags, Libraries and Includes
CFLAGS := -ggdb
LIB := -lgtest -lpthread
INC := -I$(INCDIR)
INCDEP := -I$(INCDIR)
#Files
DGENCONFIG := docs.config
HEADERS := $(wildcard $(INCDIR)/*.h)
SOURCES := $(wildcard $(SRCDIR)/*.cc)
OBJECTS := $(patsubst %.cc, $(BUILDDIR)/%.o, $(notdir $(SOURCES)))
#Defauilt Make
all: directories $(TARGETDIR)/$(TARGET) tests example
echo $(SOURCES) $(HEADERS)
#Remake
remake: cleaner all
#Make the Directories
directories:
@mkdir -p $(TARGETDIR)
@mkdir -p $(BUILDDIR)
tests:
cd test && $(MAKE)
example:
cd examples && $(MAKE)
docs: docs/index.html
docs/index.html: $(SOURCES) $(HEADERS) README.md docs.config dox/* examples/*.cc
$(DGEN) $(DGENCONFIG)
cp .nojekyll docs
#Clean only Objects
clean:
@$(RM) -rf $(BUILDDIR)/*.o
cd test && $(MAKE) clean
cd examples && $(MAKE) clean
#Full Clean, Objects and Binaries
spotless: clean
@$(RM) -rf $(TARGETDIR)/$(TARGET) *.db
@$(RM) -rf build lib docs/*
cd test && $(MAKE) spotless
#Link
$(TARGETDIR)/$(TARGET): $(OBJECTS) $(HEADERS)
ar rvs $@ $(OBJECTS)
#Compile
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT) $(HEADERS)
$(CC) $(CFLAGS) $(INC) -c -fPIC -o $@ $<