Zernit/Makefile

136 lines
3.6 KiB
Makefile
Raw Normal View History

2020-01-18 12:43:35 +01:00
# FIXME: in-code docs needed
2020-02-05 10:06:21 +01:00
# FIXME: Windows doesn't support makefiles natively -> if you have a better method then please MR it or make an issue
## Syntax capture ##
2020-01-12 01:57:48 +01:00
all:
2020-02-05 10:06:21 +01:00
@ printf '%s\n' "Unknown option '$1' parsed in target all"
@ exit 2
## BUILD ##
# All build targets are expected in 'build/build-LANG' where 'LANG' is the unique identifier of the language used
2020-02-06 02:49:13 +01:00
# FIXME: Replace 'exit 1' with helpful messages
2020-02-05 10:06:21 +01:00
2020-02-07 11:19:50 +01:00
# Fetch files from third parties
vendor:
@ [ ! -d vendor ] && mkdir vendor
@ [ ! -d vendor/rustlang ] && mkdir vendor/rustlang
2020-02-07 20:23:09 +01:00
@ [ ! -d vendor/rustlang/clap-rs ] && git clone https://github.com/clap-rs/clap.git vendor/rustlang/clap-rs
@ for file in vendor/rustlang/clap-rs/benches/*; do cp "$$file" benches/rustlang/claprs-$${file##vendor/rustlang/clap-rs/benches/??_}; done
2020-02-10 16:14:58 +01:00
build: build-rustlang build-clang-c build-gcc-c build-gcc-ccp build-clang build-brainfuck build-python build-vlang build-golang
2020-02-06 04:32:56 +01:00
2020-02-05 10:06:21 +01:00
# FIXME: Build in '$repodir/build/build-rustlang' instead of '$repodir/target' for multilang support
build-rustlang:
2020-02-06 03:34:01 +01:00
@ cargo build --verbose
2020-02-07 14:20:50 +01:00
# FIXME: Add logic
build-clang-c:
2020-02-08 07:11:21 +01:00
@ exit 1
2020-02-07 14:20:50 +01:00
build-gcc-c:
2020-02-06 02:49:13 +01:00
@ # Make a build directory
@ [ ! -d build ] && { mkdir build || exit 1 ;}
@ [ ! -d build/target-gc ] && { mkdir build/build-gc || exit 1 ;}
@ # Compilation
2020-02-06 03:34:01 +01:00
@ ## gc is not available on github -> Using GCC
@
@ [ ! -f build/build-gc/gc-zernit ] && { gcc src/bin/main.c -o build/build-gc/gc-zernit || exit 1 ;}
2020-02-06 02:49:13 +01:00
@ printf '%s\n' "Compilation of target for gc finished"
2020-02-05 10:06:21 +01:00
# FIXME: Replace 'exit 1' with helpful messages
2020-02-07 15:43:55 +01:00
build-gcc-ccp:
2020-02-05 10:06:21 +01:00
@ # Make a build directory
@ [ ! -d build ] && { mkdir build || exit 1 ;}
@ [ ! -d build/target-gcc ] && { mkdir build/build-gcc || exit 1 ;}
2020-01-18 12:43:35 +01:00
2020-02-05 10:06:21 +01:00
@ # Compilation
2020-02-07 14:20:50 +01:00
@ [ ! -f build/build-gcc ] && { gcc src/bin/main.c -o build/build-gcc/gcc-zernit || exit 1 ;}
2020-02-05 10:06:21 +01:00
@ printf '%s\n' "Compilation of target for gcc finished"
2020-02-07 14:20:50 +01:00
build-clang-ccp:
2020-02-05 10:06:21 +01:00
@ printf 'FIXME: %s\n' "translate zernit in clang"
@ exit 1
2020-01-18 12:43:35 +01:00
2020-02-05 10:06:21 +01:00
build-brainfuck:
@ printf 'FIXME: %s\n' "translate zernit in brainfuck"
@ exit 1
2020-02-07 13:24:03 +01:00
# FIXME: requires python3.6+ and pip3
2020-02-05 10:06:21 +01:00
build-python:
2020-02-07 13:24:03 +01:00
@ pip3 install -r requirements.txt
2020-01-18 12:43:35 +01:00
2020-02-07 05:53:27 +01:00
build-vlang:
2020-02-07 17:44:04 +01:00
@ [ ! -d build ] && mkdir build
@ [ ! -d build/build-vlang ] && mkdir build/build-vlang
2020-02-07 19:22:07 +01:00
@ /opt/vlang/v -o build/build-vlang/zernit-vlang src/bin/main.v
2020-02-07 05:53:27 +01:00
2020-02-07 18:38:34 +01:00
build-golang:
@ [ ! -d build ] && mkdir build
@ [ ! -d build/build-golang ] && mkdir build/build-golang
@ go build -o build/build-golang/zernit-golang src/bin/main.go
2020-02-06 02:49:13 +01:00
## CHECK/TESTS ##
2020-02-06 04:32:56 +01:00
check:
@ printf 'FIXME: %s\n' "Check all targets if executed"
@ exit 1
2020-02-07 14:20:50 +01:00
check-gcc-c:
2020-02-06 02:49:13 +01:00
@ printf 'FIXME: %s\n' "Add tests for gc"
@ exit 1
2020-02-07 14:20:50 +01:00
check-clang-c:
2020-02-06 02:49:13 +01:00
@ printf 'FIXME: %s\n' "Add tests for gcc"
@ exit 1
2020-02-07 14:20:50 +01:00
check-gcc-ccp:
2020-02-06 02:49:13 +01:00
@ printf 'FIXME: %s\n' "Add tests for clang"
@ exit 1
check-python:
@ printf 'FIXME: %s\n' "Add tests for python"
@ exit 1
check-rustlang:
@ printf 'FIXME: %s\n' "Add tests for rustlang"
@ exit 1
check-brainfuck:
@ printf 'FIXME: %s\n' "Add tests for brainfuck"
@ exit 1
check-shell:
@ printf 'FIXME: %s\n' "Add tests for shell"
@ exit 1
check-bash:
@ printf 'FIXME: %s\n' "Add tests for bash"
@ exit 1
2020-02-07 05:53:27 +01:00
check-vlang:
@ printf 'FIXME: %s\n' "Add tests for vlang"
@ exit 1
2020-02-07 14:20:50 +01:00
## BENCHES ##
# FIXME: Run all benches if this is executed
2020-02-07 20:23:09 +01:00
bench: bench-rustlang
2020-02-07 14:20:50 +01:00
# FIXME: Run vendor and
2020-02-07 20:23:09 +01:00
bench-rustlang: vendor
2020-02-07 14:20:50 +01:00
@ cargo bench
2020-02-05 10:06:21 +01:00
## CLEAN ##
2020-01-18 12:43:35 +01:00
2020-02-09 16:29:08 +01:00
clean: clean-vendor clean-benches
2020-02-07 20:23:09 +01:00
@ [ -d build ] && rm -rf build
2020-02-07 11:19:50 +01:00
@ printf '%s\n' "Build directory has been cleaned"
clean-vendor:
@ # FIXME: Output helpful message if directory doesn't exists
2020-02-09 16:29:08 +01:00
@ [ -d vendor ] && rm -rf vendor
clean-benches:
@ for file in benches/rustlang/claprs-*; do rm "$$file"; done