-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (33 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
# ------------------------------------------------------------
# Makefile for CMPUT 379 A4
#
# Usage: make // compile the programs
# make tar // create a 'tar.gz' archive of 'allFiles'
# make clean // remove unneeded files
# ------------------------------------------------------------
CC= g++
CFLAGS= -std=c++11 -Wall -I. -pthread
MKDIR = mkdir
target= submit
BINARY = a4tasks
BUILDDIR = build
SOURCEDIR = src
HEADERDIR = src
CPP_FILES := $(shell find $(SOURCEDIR) -name '*.cpp')
SOURCES = $(shell find $(SOURCEDIR) -name '*')
OBJECTS := $(addprefix $(BUILDDIR)/,$(CPP_FILES:%.cpp=%.o))
SUBMIT_FILES = $(SOURCES) Makefile report.pdf
# ------------------------------------------------------------
all: setup $(BINARY)
$(BINARY): $(OBJECTS)
$(CC) $(CFLAGS) $(OBJECTS) -o $(BINARY)
$(BUILDDIR)/%.o: %.cpp
$(CC) $(CFLAGS) -I$(HEADERDIR) -I$(dir $<) -c $< -o $@
setup:
$(MKDIR) -p $(BUILDDIR)/$(SOURCEDIR)
tar:
tar -cvf $(target).tar $(SUBMIT_FILES)
gzip $(target).tar
clean:
rm $(BUILDDIR) -rf
rm $(target).tar.gz -f