diff options
-rw-r--r-- | Dockerfile | 10 | ||||
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | README.md | 8 | ||||
-rwxr-xr-x | ci.sh | 4 |
4 files changed, 21 insertions, 13 deletions
@@ -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 @@ -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))' \ @@ -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). @@ -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() { |