-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
57 lines (40 loc) · 977 Bytes
/
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
#HOW-TO:
# make to compile
# make clean cleaning objects directory
# make bclean cleaning all files
# make rebuild clean and remake
# compiler
CC = g++
# compile arguments
CFLAGS = -Wall -g -fexceptions -std=c++11 -D_REENTRANT -pthread
# linker flags
LDFLAGS = -g -std=c++11
# libraries
LIBS = -lcrypto -lssl
#our source files
SOURCES = $(wildcard *.cpp)
# a macro to define the objects from sources
BUILD_DIR := build
OBJC=$(SOURCES:%.cpp=${BUILD_DIR}/%.o)
# executable name
EXECUTABLE=jce
.PHONY: all
all: $(EXECUTABLE)
$(EXECUTABLE): $(OBJC)
@echo "Building target" $@
@$(CC) $(LDFLAGS) -o $@ $(OBJC) $(LIBS)
@echo "Done."
# a rule for generating object files given their c files
#.cpp.o: /$(OBJCDIR)
${BUILD_DIR}/%.o: %.cpp
@mkdir -p $(dir $@)
@$(CC) $(CFLAGS) -c $< -o $@
clean:
@echo "Ceaning up *.o Files"
@rm -rf ${BUILD_DIR}
@echo "Done."
bclean:
@echo "Ceaning all"
@rm -rf $(EXECUTABLE) ${BUILD_DIR}
@echo "Done."
rebuild: bclean all