2020-04-27 00:46:05 +00:00
|
|
|
.PHONY: cryptomain.ex crypt.ex decrypt.ex
|
|
|
|
|
2020-04-28 21:50:17 +00:00
|
|
|
GCXX_DEBUG=-ggdb
|
|
|
|
CFLAGS=-Wall -Wextra --std=c++14 $(GCXX_DEBUG)
|
|
|
|
LDFLAGS=-lcrypto
|
|
|
|
CXX=g++
|
|
|
|
|
2020-04-26 22:07:17 +00:00
|
|
|
BIN_PATH=./bin
|
|
|
|
LIB_PATH=./lib
|
|
|
|
OBJ_PATH=./obj
|
|
|
|
|
|
|
|
EXEC=$(BIN_PATH)/cryptomain.ex
|
2016-03-07 09:54:50 +00:00
|
|
|
SRC=main.cpp
|
2020-04-28 21:50:17 +00:00
|
|
|
JSONCPP_O=$(OBJ_PATH)/jsoncpp.o
|
|
|
|
BASE64_O=$(OBJ_PATH)/base64.o
|
2016-03-06 19:20:50 +00:00
|
|
|
|
2020-04-27 00:46:05 +00:00
|
|
|
cryptomain.ex: $(EXEC)
|
|
|
|
|
2020-04-26 22:07:17 +00:00
|
|
|
# merge crypt and decrypt binary into cryptomain
|
2020-04-28 21:50:17 +00:00
|
|
|
$(EXEC): $(SRC) *.hpp $(JSONCPP_O) $(BASE64_O)
|
2016-03-06 19:20:50 +00:00
|
|
|
@echo "compilation de aes"
|
2020-04-28 21:50:17 +00:00
|
|
|
@$(CXX) $(CFLAGS) $(LDFLAGS) -o $(EXEC) $(SRC) $(JSONCPP_O) $(BASE64_O)
|
|
|
|
|
|
|
|
SOURCES_BASE64=$(wildcard $(LIB_PATH)/base64/base64.*)
|
|
|
|
$(BASE64_O): $(SOURCES_BASE64)
|
|
|
|
@echo "compilation de base64"
|
|
|
|
@$(CXX) $(CFLAGS) -c $(LIB_PATH)/base64/base64.cpp -o $(BASE64_O)
|
2016-03-06 19:20:50 +00:00
|
|
|
|
2020-04-28 21:50:17 +00:00
|
|
|
SOURCES_JSON_CPP :=$(LIB_PATH)/jsoncpp.cpp $(wildcard $(LIB_PATH)/*.h)
|
|
|
|
$(JSONCPP_O): $(SOURCES_JSON_CPP)
|
2016-03-06 19:20:50 +00:00
|
|
|
@echo "compilation de jsoncpp"
|
2020-04-28 21:50:17 +00:00
|
|
|
@$(CXX) $(CFLAGS) -I ../lib/jsoncpp-master/include/ -c $(LIB_PATH)/jsoncpp.cpp -o $(JSONCPP_O)
|
2020-04-26 22:07:17 +00:00
|
|
|
|
|
|
|
run: $(EXEC)
|
|
|
|
@./$(EXEC) data/cryptomain/file
|
2016-03-06 19:20:50 +00:00
|
|
|
|
2020-04-26 22:07:17 +00:00
|
|
|
# separate crypt and decrypt binary
|
|
|
|
EXEC_DECRYPT=$(BIN_PATH)/decrypt.ex
|
|
|
|
EXEC_CRYPT=$(BIN_PATH)/crypt.ex
|
|
|
|
SRC_CRYPT=mainCrypt.cpp
|
|
|
|
SRC_DECRYPT=mainDecrypt.cpp
|
2016-01-20 19:25:02 +00:00
|
|
|
|
2020-04-27 00:46:05 +00:00
|
|
|
crypt.ex: $(EXEC_CRYPT)
|
|
|
|
decrypt.ex: $(EXEC_DECRYPT)
|
|
|
|
|
2020-04-28 21:50:17 +00:00
|
|
|
$(EXEC_CRYPT): $(SRC_CRYPT) *.hpp $(JSONCPP_O) $(BASE64_O)
|
2020-04-26 22:07:17 +00:00
|
|
|
@echo "compilation de crypt.ex"
|
2020-04-28 21:50:17 +00:00
|
|
|
@$(CXX) $(CFLAGS) $(LDFLAGS) -o $(EXEC_CRYPT) $(SRC_CRYPT) $(JSONCPP_O) $(BASE64_O)
|
2016-03-06 19:20:50 +00:00
|
|
|
|
2020-04-28 21:50:17 +00:00
|
|
|
$(EXEC_DECRYPT): $(SRC_DECRYPT) *.hpp $(JSONCPP_O) $(BASE64_O)
|
2016-03-06 19:20:50 +00:00
|
|
|
@echo "compilation de decrypt.ex"
|
2020-04-28 21:50:17 +00:00
|
|
|
@$(CXX) $(CFLAGS) $(LDFLAGS) -o $(EXEC_DECRYPT) $(SRC_DECRYPT) $(JSONCPP_O) $(BASE64_O)
|
2016-03-06 19:20:50 +00:00
|
|
|
|
2020-04-26 22:07:17 +00:00
|
|
|
run2: $(EXEC_CRYPT) $(EXEC_DECRYPT)
|
|
|
|
@./$(EXEC_CRYPT) data/crypt_decrypt/file && ./$(EXEC_DECRYPT) data/crypt_decrypt/file.enc data/crypt_decrypt/file.key
|
2016-01-23 21:57:15 +00:00
|
|
|
|
2020-04-26 22:07:17 +00:00
|
|
|
# debug target
|
2016-01-23 21:57:15 +00:00
|
|
|
valgrind:
|
2016-03-06 19:20:50 +00:00
|
|
|
@valgrind --leak-check=full --track-origins=yes ./$(EXEC) file
|
|
|
|
|
2020-04-26 22:07:17 +00:00
|
|
|
# clean target
|
2016-03-06 19:20:50 +00:00
|
|
|
clean: cleanO cleanB
|
|
|
|
|
|
|
|
cleanO:
|
2020-04-26 22:07:17 +00:00
|
|
|
@rm -rf $(OBJ_PATH)/*.o
|
2016-03-06 19:20:50 +00:00
|
|
|
|
|
|
|
cleanB:
|
2020-04-26 22:07:17 +00:00
|
|
|
@rm -rf $(BIN_PATH)/*.ex
|
2016-01-17 23:12:13 +00:00
|
|
|
|
2016-03-06 19:20:50 +00:00
|
|
|
cleanD:
|
2020-04-26 22:07:17 +00:00
|
|
|
@rm -f data/*.enc
|
|
|
|
@rm -f data/*.dec
|
|
|
|
@rm -f data/*.key
|
2020-04-27 00:46:05 +00:00
|
|
|
|
|
|
|
doc:
|
|
|
|
@pandoc -s -f markdown+emoji -t html \
|
|
|
|
--shift-heading-level-by=2 \
|
|
|
|
--wrap=preserve \
|
|
|
|
--toc \
|
|
|
|
--toc-depth=2 \
|
|
|
|
--highlight-style=tango \
|
|
|
|
-o readme.html readme.md
|