-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (55 loc) · 1.51 KB
/
Makefile
File metadata and controls
75 lines (55 loc) · 1.51 KB
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
70
71
72
73
74
75
LIBSRC=src
LIBRARY=$(LIBDIR)/libff.a
CMDSRC=$(wildcard cmd/*)
BINDIR:=bin
OBJDIR:=obj
INCDIR:=include
LIBDIR:=lib
ARCHIVER:=ar rcs
COMPILER:=g++ -c
LINKER:=g++
LIBS+=-lm
FLAGS+=-Wall -pedantic
# Derived Library Variables
LIBSOURCES=$(wildcard $(addsuffix /*.cpp,$(LIBSRC)))
LIBOBJ=$(subst src,$(OBJDIR),$(LIBSOURCES:%.cpp=%.o))
# Derived Executable Variables
CMDSOURCES=$(addsuffix /main.cpp,$(CMDSRC))
CMDOBJ=$(CMDSOURCES:%.cpp=%.o)
CMDBIN=$(subst cmd,$(BINDIR),$(CMDSRC))
all: FLAGS:=-Wall -pedantic -g -pg
all: $(LIBRARY)
release: FLAGS:=-Wall -pedantic -O3
release: $(CMDBIN)
exec: FLAGS:=-Wall -pedantic -g -pg
exec: $(CMDBIN)
# Archiving, Compiling and Cleaning the library
$(LIBRARY): $(LIBOBJ)
@echo "Creating the FF Framework Library"
@mkdir -p $(@D)
@$(ARCHIVER) $(LIBRARY) $(LIBOBJ)
obj/%.o: src/%.cpp
@echo "Compiling ($(FLAGS)) $@"
@mkdir -p $(@D)
@$(COMPILER) -I$(INCDIR) $(FLAGS) -o $@ $<
clean-lib:
@echo "Cleaning FF Framework objects and static libraries"
@rm -f $(LIBRARY) $(LIBOBJ)
# Linking, Compiling and Cleaning the executables
$(BINDIR)/%: LIBS+=-lff
$(BINDIR)/%: cmd/%/main.cpp $(LIBRARY)
@echo "Compiling and linking ($(FLAGS)) $@"
@mkdir -p $(BINDIR)
@$(LINKER) -I$(INCDIR) -L$(LIBDIR) $(FLAGS) -o $@ $< $(LIBS)
clean-exec:
@echo "Cleaning command object and binary files"
@rm -f $(CMDBIN)
clean: clean-lib clean-exec
# Making Documentation
doc:
@doxygen
@make -C share/latex
clean-doc:
@echo "Cleaning documentation"
@rm -rf share
.PHONY: clean clean-lib clean-exec clean-doc