Files
SeaWeb/Makefile
2022-03-08 23:40:27 -05:00

50 lines
1.5 KiB
Makefile

LIBRARIES = `pkg-config --libs openssl` -Iinclude
SOURCES = ./src/* ./cmd/server.c
OUTPUT_DIR = ./bin
OUTPUT = -o ${OUTPUT_DIR}/PROG
INSTALL_OUTPUT = ${OUTPUT_DIR}/PROG
build: output_dir
gcc -Wall ${SOURCES} ${OUTPUT:PROG=seaweb} ${LIBRARIES}
debug: output_dir
gcc -Wall -g ${SOURCES} ${OUTPUT:PROG=seaweb} ${LIBRARIES}
install:
mv ${INSTALL_OUTPUT:PROG=seaweb} /usr/bin/
output_dir:
mkdir -p ${OUTPUT_DIR}
mkdir -p ./log
CERT_DIR = ./certs/
clean:
rm -rf $(OUTPUT_DIR) ${CERT_DIR} **.h.gch
genCerts:
mkdir -p ${CERT_DIR}
touch ${CERT_DIR}index.txt
openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 \
-sha256 -nodes -out ${CERT_DIR}cacert.pem -keyout ${CERT_DIR}cakey.pem \
-outform PEM -subj "/C=US/ST=Some-State/L=[]/O=[]/CN=localhost"
openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:prime256v1 \
-nodes -days 365 -out ${CERT_DIR}cert.csr -keyout ${CERT_DIR}key.pem \
-subj "/C=US/ST=Some-State/L=[]/O=[]/CN=localhost"
openssl ca -policy signing_policy -extensions signing_req \
-cert ./certs/cacert.pem -keyfile ./certs/cakey.pem \
-rand_serial -config ./ca/ca.cnf \
-out ./certs/cert.pem -infiles ./certs/cert.csr
dockerBuild: output_dir
docker build . -t seaweb:latest
dockerTestDeploy: dockerBuild
docker run -p8080:8080 --rm -d seaweb:latest
dockerReleaseDeploy: dockerBuild
docker run -p8080:8080 --rm -d seaweb:latest --cert /src/certs/cert.pem --privkey /src/certs/key.pem --verbose
killTestDocker:
docker stop -t 0 `docker ps | grep "seaweb:latest" | tail -n 1 | tr -s " " | cut -d " " -f 1`