77 lines
1.8 KiB
Makefile
77 lines
1.8 KiB
Makefile
.PHONY: cryptomain.ex crypt.ex decrypt.ex doxygenconf
|
|
|
|
GCXX_DEBUG=-ggdb
|
|
CFLAGS=-Wall -Wextra --std=c++14 $(GCXX_DEBUG)
|
|
LDFLAGS=$(shell pkg-config --libs libcrypto jsoncpp)
|
|
CXX=g++
|
|
|
|
BIN_PATH=./bin
|
|
LIB_PATH=./lib
|
|
OBJ_PATH=./obj
|
|
|
|
EXEC=$(BIN_PATH)/cryptomain.ex
|
|
SRC=main.cpp
|
|
BASE64_O=$(OBJ_PATH)/base64.o
|
|
|
|
cryptomain.ex: $(EXEC)
|
|
|
|
# merge crypt and decrypt binary into cryptomain
|
|
$(EXEC): $(SRC) *.hpp $(BASE64_O)
|
|
@echo "compilation de aes"
|
|
@$(CXX) $(CFLAGS) $(LDFLAGS) -o $(EXEC) $(SRC) $(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)
|
|
|
|
run: $(EXEC)
|
|
@./$(EXEC) data/cryptomain/file
|
|
|
|
# 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
|
|
|
|
crypt.ex: $(EXEC_CRYPT)
|
|
decrypt.ex: $(EXEC_DECRYPT)
|
|
|
|
$(EXEC_CRYPT): $(SRC_CRYPT) *.hpp $(BASE64_O)
|
|
@echo "compilation de crypt.ex"
|
|
@$(CXX) $(CFLAGS) $(LDFLAGS) -o $(EXEC_CRYPT) $(SRC_CRYPT) $(BASE64_O)
|
|
|
|
$(EXEC_DECRYPT): $(SRC_DECRYPT) *.hpp $(BASE64_O)
|
|
@echo "compilation de decrypt.ex"
|
|
@$(CXX) $(CFLAGS) $(LDFLAGS) -o $(EXEC_DECRYPT) $(SRC_DECRYPT) $(BASE64_O)
|
|
|
|
run2: $(EXEC_CRYPT) $(EXEC_DECRYPT)
|
|
@./$(EXEC_CRYPT) data/crypt_decrypt/file && ./$(EXEC_DECRYPT) data/crypt_decrypt/file.enc data/crypt_decrypt/file.key
|
|
|
|
# debug target
|
|
valgrind:
|
|
@valgrind --leak-check=full --track-origins=yes ./$(EXEC) file
|
|
|
|
# clean target
|
|
clean: cleanO cleanB
|
|
|
|
cleanO:
|
|
@rm -rf $(OBJ_PATH)/*.o
|
|
|
|
cleanB:
|
|
@rm -rf $(BIN_PATH)/*.ex
|
|
|
|
cleanD:
|
|
@rm -f data/*.enc
|
|
@rm -f data/*.dec
|
|
@rm -f data/*.key
|
|
|
|
markdown:
|
|
@pandoc --defaults=pandocConfig.yaml
|
|
|
|
doxygenconf:
|
|
@doxygen -g doxygen.conf
|
|
|
|
doc: doxygen.conf
|
|
@doxygen doxygen.conf
|