39 lines
835 B
Makefile
39 lines
835 B
Makefile
CC = gcc
|
|
CFLAGS = -Wall -Wpedantic -Wextra -std=c99 -fstack-protector-all \
|
|
-fdiagnostics-color=auto
|
|
DEBUG = -0g -ggdb
|
|
LINK =
|
|
LIB_INC =
|
|
SRC_DIR = src
|
|
OUT_DIR = bin
|
|
TARGETS = base64 fixed-xor char-freq-analyze repeating-key-xor aes-ecb
|
|
|
|
AES_LIB = mbedtls
|
|
#AES_LIB = tiny-AES-c
|
|
|
|
# choose which AES library to use
|
|
ifeq (mbedtls,$(AES_LIB))
|
|
EXT_INCLUDES = -Iaes-libs/mbedtls/include/
|
|
EXT_LIBS = -Laes-libs/mbedtls/library
|
|
LDLIBS = -lmbedcrypto
|
|
else
|
|
#EXT_INCLUDES = -Iaes-libs/tiny-AES-c
|
|
EXT_LIBS = -Laes-libs/tiny-AES-c
|
|
#LDLIBS = -laes
|
|
endif
|
|
|
|
|
|
all: $(TARGETS)
|
|
|
|
%: $(SRC_DIR)/%.c
|
|
$(CC) $(CFLAGS) -o $(OUT_DIR)/$@ $<
|
|
|
|
aes-ecb: $(SRC_DIR)/aes-ecb.c
|
|
$(CC) $(CFLAGS) $(EXT_INCLUDES) $(EXT_LIBS) -o $(OUT_DIR)/$@ $< $(LDLIBS)
|
|
|
|
clean:
|
|
$(RM) *.o $(OUT_DIR)/*
|
|
|
|
.PHONY: all clean
|
|
|