-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
64 lines (50 loc) · 1.25 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
# Makefile for the GREMLINS project
# Author:
# + Felipe Ramos
# + Max William
# Makefile conventions
SHELL = /bin/sh
# Directories
INCDIR = ./include
SRCDIR = ./src
OBJDIR = ./obj
BINDIR = ./bin
DATADIR = ./data
DOCDIR = ./Documentation
# Macros
CC = g++
CFLAGS = -Wall -g -ggdb -std=c++11 -I. -I$(INCDIR)
RM = -rm
PROJ_NAME = gremlins
DOC_NAME = index.html
HEADERS := $(wildcard $(INCDIR)/*)
SOURCES := $(wildcard $(SRCDIR)/*.cpp)
OBJECTS := $(SOURCES:$(SRCDIR)/%.cpp=$(OBJDIR)/%.o)
all: project documentation
project: $(OBJECTS) $(HEADERS) | $(BINDIR)
$(CC) $(OBJECTS) $(CFLAGS) -o $(BINDIR)/$(PROJ_NAME)
@ln -sfv $(BINDIR)/$(PROJ_NAME) $(PROJ_NAME)
documentation:
@mkdir -p $(DOCDIR)
@doxygen config
@ln -sfv $(DOCDIR)/html/index.html $(DOC_NAME)
$(OBJECTS): $(OBJDIR)/%.o : $(SRCDIR)/%.cpp $(HEADERS) | $(OBJDIR)
$(CC) $(CFLAGS) -c $< -o $@
$(OBJDIR):
@mkdir -p $(OBJDIR)
$(BINDIR):
@mkdir -p $(BINDIR)
# Clean PHONY targets
.PRONY: clean clean_proj
clean: clean_proj
clean_proj:
@echo "Removing OBJDIR..."
@$(RM) -r $(OBJDIR)
@echo "Removing BINDIR..."
@$(RM) -r $(BINDIR)
@echo "Removing documentation files..."
@$(RM) -r Documentation/
@echo "Removing symlink..."
@$(RM) -f $(PROJ_NAME)
@$(RM) -f $(DOC_NAME)
@echo "Clean-up completed!"