-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (45 loc) · 1.15 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
CFLAGS = -MMD -g -Wall -pedantic
CXXFLAGS = -MMD -g -Wall -pedantic
LIBS = -lm
CC = gcc
CXX = g++
OFILES = $(patsubst %.c,%.o,$(wildcard *.c)) $(patsubst %.cpp,%.o,$(wildcard *.cpp))
DFILES = $(patsubst %.c,%.d,$(wildcard *.c)) $(patsubst %.cpp,%.d,$(wildcard *.cpp))
HFILES = $(wildcard *.h *.hpp)
PROG = cachesim
TARBALL = $(if $(USER),$(USER),gburdell3)-proj1.tar.gz
ifdef PROFILE
FAST=1
undefine DEBUG
CFLAGS += -pg
CXXFLAGS += -pg
LIBS += -pg
endif
ifdef DEBUG
CFLAGS += -DDEBUG
CXXFLAGS += -DDEBUG
endif
ifdef FAST
CFLAGS += -O2
CXXFLAGS += -O2
endif
.PHONY: all validate submit clean
all: $(PROG)
$(PROG): $(OFILES)
$(CXX) -o $@ $^ $(LIBS)
%.o: %.c $(HFILES)
$(CC) $(CFLAGS) -c -o $@ $<
%.o: %.cpp $(HFILES)
$(CXX) $(CXXFLAGS) -c -o $@ $<
validate: $(PROG)
@./validate.sh
submit: clean
tar --exclude=project1_description.pdf -czhvf $(TARBALL) run.sh Makefile $(wildcard *.pdf *.cpp *.c *.hpp *.h)
@echo
@echo 'submission tarball written to' $(TARBALL)
@echo 'please decompress it yourself and make sure it looks right!'
clean:
rm -f $(TARBALL) $(PROG) $(OFILES) $(DFILES)
-include $(DFILES)
# if you're a student, ignore this
-include ta-rules.mk