aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2023-05-13 14:33:49 +0200
committerEgor Tensin <Egor.Tensin@gmail.com>2023-05-13 14:33:55 +0200
commit16cfe4827f4e2c9796a4b283077c5522a04a4da3 (patch)
tree1a72e35f03af2de1d45408cbb3cb4ec8dd4ba663
parentctest: don't use the -C parameter (diff)
downloadcimple-16cfe4827f4e2c9796a4b283077c5522a04a4da3.tar.gz
cimple-16cfe4827f4e2c9796a4b283077c5522a04a4da3.zip
rename Makefile parameters & update README
-rw-r--r--Dockerfile10
-rw-r--r--Makefile12
-rw-r--r--README.md8
-rwxr-xr-xci.sh4
4 files changed, 21 insertions, 13 deletions
diff --git a/Dockerfile b/Dockerfile
index a981556..9de14e1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -7,8 +7,8 @@ FROM base AS builder
RUN build_deps='bash bsd-compat-headers build-base clang cmake coreutils libgit2-dev py3-pytest sqlite-dev valgrind' && \
apk add -q --no-cache $build_deps
-ARG C_COMPILER=clang
-ARG BUILD_TYPE=Release
+ARG COMPILER=clang
+ARG CONFIGURATION=Release
ARG DEFAULT_HOST=127.0.0.1
ARG src_dir="/app/src"
@@ -18,11 +18,11 @@ COPY [".", "$src_dir"]
RUN cd -- "$src_dir" && \
make install \
- "C_COMPILER=$C_COMPILER" \
- "BUILD_TYPE=$BUILD_TYPE" \
+ "COMPILER=$COMPILER" \
+ "CONFIGURATION=$CONFIGURATION" \
"DEFAULT_HOST=$DEFAULT_HOST" \
"INSTALL_PREFIX=$install_dir" && \
- make test BUILD_TYPE="$BUILD_TYPE"
+ make test CONFIGURATION="$CONFIGURATION"
FROM base
diff --git a/Makefile b/Makefile
index 509c6b0..d770648 100644
--- a/Makefile
+++ b/Makefile
@@ -25,13 +25,13 @@ build_dir := $(src_dir)/build
cmake_dir := $(build_dir)/cmake
install_dir := $(build_dir)/install
-C_COMPILER ?= clang
-BUILD_TYPE ?= Debug
+COMPILER ?= clang
+CONFIGURATION ?= Debug
DEFAULT_HOST ?= 127.0.0.1
INSTALL_PREFIX ?= $(install_dir)
-$(eval $(call noexpand,C_COMPILER))
-$(eval $(call noexpand,BUILD_TYPE))
+$(eval $(call noexpand,COMPILER))
+$(eval $(call noexpand,CONFIGURATION))
$(eval $(call noexpand,DEFAULT_HOST))
$(eval $(call noexpand,INSTALL_PREFIX))
@@ -47,8 +47,8 @@ build:
mkdir -p -- '$(call escape,$(cmake_dir))'
cmake \
-G 'Unix Makefiles' \
- -D 'CMAKE_C_COMPILER=$(call escape,$(C_COMPILER))' \
- -D 'CMAKE_BUILD_TYPE=$(call escape,$(BUILD_TYPE))' \
+ -D 'CMAKE_C_COMPILER=$(call escape,$(COMPILER))' \
+ -D 'CMAKE_BUILD_TYPE=$(call escape,$(CONFIGURATION))' \
-D 'CMAKE_INSTALL_PREFIX=$(call escape,$(INSTALL_PREFIX))' \
-D 'DEFAULT_HOST=$(call escape,$(DEFAULT_HOST))' \
-S '$(call escape,$(src_dir))' \
diff --git a/README.md b/README.md
index 4045246..1f4e4ea 100644
--- a/README.md
+++ b/README.md
@@ -16,6 +16,14 @@ directory:
make build
+This command makes a CMake build directory in build/cmake/ and executes `make`
+there.
+
+The default is to build using clang in `Release` configuration.
+You can choose a different compiler and configuration like so:
+
+ make build COMPILER=gcc CONFIGURATION=Debug
+
### Testing
After building, you can run the "test suite" (depends on Pytest).
diff --git a/ci.sh b/ci.sh
index cd7baa9..dd45b89 100755
--- a/ci.sh
+++ b/ci.sh
@@ -12,7 +12,7 @@ test_build_clang() {
echo Building w/ clang
echo ----------------------------------------------------------------------
echo
- test_build --build-arg C_COMPILER=clang
+ test_build --build-arg COMPILER=clang
}
test_build_gcc() {
@@ -20,7 +20,7 @@ test_build_gcc() {
echo Building w/ gcc
echo ----------------------------------------------------------------------
echo
- test_build --build-arg C_COMPILER=gcc
+ test_build --build-arg COMPILER=gcc
}
main() {