This repository was archived by the owner on Jun 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
47 lines (39 loc) · 1.35 KB
/
Makefile
File metadata and controls
47 lines (39 loc) · 1.35 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
#
# [Application Name]
#
# Author : name <email>
# Readme : README.md
# Website : http://website.com
# TODO : A todo note example
# Fix : A fix note example
#
CC := g++ # Main compiler
SRCDIR := src # Source Directory
BUILDDIR := build # Build Directory
TESTDIR := test # Tests Directory
TESTAPP := example # Test name
BINDIR := bin # App, tests, spikes executables
TARGET := bin/applicationname # Main executable of the project
SRCEXT := cpp # Extension
SOURCES := $(shell find $(SRCDIR) -type f -name *.$(SRCEXT)) # Source files (Dynamic)
OBJECTS := $(patsubst $(SRCDIR)/%,$(BUILDDIR)/%,$(SOURCES:.$(SRCEXT)=.o)) # Object files (Dynamic)
CFLAGS := -g -Wall -W -Werror # Compile flags
LIB := # Libraries flags
INC := -I include # Ensures all headers in the include folder
$(TARGET): $(OBJECTS)
@echo " Linking..." # Description
@echo " $(CC) $^ -o $(TARGET) $(LIB)" # Command
$(CC) $^ -o $(TARGET) $(CFLAGS) $(LIB)
$(BUILDDIR)/%.o: $(SRCDIR)/%.$(SRCEXT)
@mkdir -p $(BUILDDIR)
@echo "$(CC) $(CFLAGS) $(INC) -c -o $@ $<";
$(CC) $(CFLAGS) $(INC) -c -o $@ $<
clean:
@echo " Cleaning...";
@echo " $(RM) -r $(BUILDDIR) $(TARGET)";
$(RM) -r $(BUILDDIR) $(TARGET)
tester:
$(CC) $(CFLAGS) $(TESTDIR)/$(TESTAPP).$(SRCEXT) $(INC) $(LIB) -o $(BINDIR)/$(TESTAPP)
example:
$(CC) $(CFLAGS) $(SPIKEDIR)/example.cpp $(INC) $(LIB) -o $(BINDIR)/example
.PHONY: clean