-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmakefile
More file actions
58 lines (45 loc) · 973 Bytes
/
makefile
File metadata and controls
58 lines (45 loc) · 973 Bytes
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
# executable
PRG = test
CC = g++ -std=c++2a
RM = rm -f
# for windows os
ifeq ($(OS),Windows_NT)
SSL = winextern\openssl
else
LIBS += -lrt
SSL_INC = /usr/include/openssl
endif
# directory structure
7Z_DIR = extern/7z
ODIR = obj
SDIR = src
# objects, src and user libs
SOURCES = $(wildcard $(SDIR)/*.cpp)
OBJ := $(SOURCES:$(SDIR)/%.cpp=$(ODIR)/%.o)
LIBS += -lssl -lcrypto -lpthread
FLAGS += -O2
FLAGS += -Wall -fpermissive -Iinclude -I$(SSL_INC) -I$(7Z_DIR)
ARGS_EXTERN = all
# default rule and rule shortcuts
all: lib7z.a $(OBJ)
$(CC) $(OBJ) $(7Z_DIR)/*.o -o $(PRG) $(LIBS)
debug: FLAGS += -g
debug: all
# compile 7zip
lib7z.a:
$(MAKE) -j10 -C $(7Z_DIR) $(ARGS_EXTERN)
# compile src files into objects
$(ODIR)/%.o: $(SDIR)/%.cpp
$(CC) -c -o $@ $< $(FLAGS)
clean: clean_local clean_files
$(MAKE) -C $(7Z_DIR) $@
clean_local:
$(RM) $(PRG)*
$(RM) $(ODIR)/*.o
clean_files:
$(RM) log
$(RM) temp*.*
c: clean
cl: clean_local
cf: clean_files
d: debug