-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
57 lines (45 loc) · 1.27 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
# Files to compile that don't have a main() function
CFILES = team support
# Files to compile that do have a main() function
TARGETS = client server
# Sunlab OpenSSL is 64-bit only!
BITS = 64
# Directory names
ODIR := ./obj$(BITS)
output_folder := $(shell mkdir -p $(ODIR))
# Names of files that the compiler generates
EXEFILES = $(patsubst %, $(ODIR)/%, $(TARGETS))
OFILES = $(patsubst %, $(ODIR)/%.o, $(CFILES))
EXEOFILES = $(patsubst %, $(ODIR)/%.o, $(TARGETS))
DEPS = $(patsubst %, $(ODIR)/%.d, $(CFILES) $(TARGETS))
# Use gcc
CC = gcc
CFLAGS = -MMD -O2 -m$(BITS) -ggdb -D_GNU_SOURCE
LDFLAGS = -m$(BITS) -ldl -lcrypto -lssl
# Best to be safe...
.DEFAULT_GOAL = all
.PRECIOUS: $(OFILES) $(EXEOFILES)
.PHONY: all clean
# Goal is to build all executables
all: $(EXEFILES)
# Rules for building object files
$(ODIR)/%.o: %.c
@echo "[CC] $< --> $@"
@$(CC) $< -o $@ -c $(CFLAGS)
# Rules for building executables
$(ODIR)/%: $(ODIR)/%.o $(OFILES)
@echo "[LD] $< --> $@"
@$(CC) $^ -o $@ $(LDFLAGS)
# clean by clobbering the build folder
clean:
@echo Cleaning up...
@rm -rf $(ODIR)
# submit via script
submit:
@echo "Submitting..."
/proj/spear0/cse303-submit-p5.pl
turnin:
@echo "Submitting..."
/proj/spear0/cse303-submit-p5.pl
# Include dependencies
-include $(DEPS)