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-26 22:07:17 +00:00
|
|
|
JSON_CPP=$(OBJ_PATH)/jsoncpp.o
|
2016-03-06 19:20:50 +00:00
|
|
|
|
2020-04-26 22:07:17 +00:00
|
|
|
# merge crypt and decrypt binary into cryptomain
|
|
|
|
cryptomain.ex:
|
|
|
|
$(EXEC): $(SRC) $(JSON_CPP)
|
2016-03-06 19:20:50 +00:00
|
|
|
@echo "compilation de aes"
|
2020-04-26 22:07:17 +00:00
|
|
|
@g++ -Wall -Wextra -ggdb -o $(EXEC) $(SRC) $(JSON_CPP) -lcrypto --std=c++14
|
2016-03-06 19:20:50 +00:00
|
|
|
|
2020-04-26 22:07:17 +00:00
|
|
|
$(JSON_CPP): $(LIB_PATH)/jsoncpp.cpp $(LIB_PATH)/json/json.h $(LIB_PATH)/json/json-forwards.h
|
2016-03-06 19:20:50 +00:00
|
|
|
@echo "compilation de jsoncpp"
|
2020-04-26 22:07:17 +00:00
|
|
|
@g++ -I ../lib/jsoncpp-master/include/ -Wall -Wextra -std=c++11 -c -ggdb $(LIB_PATH)/jsoncpp.cpp -o $(JSON_CPP)
|
|
|
|
|
|
|
|
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-26 22:07:17 +00:00
|
|
|
crypt.ex:
|
|
|
|
$(EXEC_CRYPT): $(SRC_CRYPT) $(JSON_CPP) aes.hpp
|
|
|
|
@echo "compilation de crypt.ex"
|
|
|
|
@g++ -Wall -Wextra -ggdb -o $(EXEC_CRYPT) $(SRC_CRYPT) $(JSON_CPP) -lcrypto --std=c++14
|
2016-03-06 19:20:50 +00:00
|
|
|
|
2020-04-26 22:07:17 +00:00
|
|
|
decrypt.ex:
|
|
|
|
$(EXEC_DECRYPT): $(SRC_DECRYPT) $(JSON_CPP) aes.hpp
|
2016-03-06 19:20:50 +00:00
|
|
|
@echo "compilation de decrypt.ex"
|
2020-04-26 22:07:17 +00:00
|
|
|
@g++ -Wall -Wextra -ggdb -o $(EXEC_DECRYPT) $(SRC_DECRYPT) $(JSON_CPP) -lcrypto --std=c++14
|
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
|