moved Makefile function into build.sh

This commit is contained in:
Václav Šmejkal 2022-04-27 18:37:15 +02:00
parent 02606e5a09
commit 39796b634e
2 changed files with 32 additions and 19 deletions

View File

@ -1,14 +0,0 @@
all: main
# Main file
files = src/test/main.c
# Source files
files += src/*.c
# Header files
files += include/*.h
main:
@echo Compiling...
cc $(files) -ljson-c -lcurl -o out/why2

View File

@ -1,12 +1,39 @@
#!/bin/bash #!/bin/bash
# Remove versions.json ####################
# Remove previous output & versions.json
rm -rf out/*
rm -f versions.json rm -f versions.json
# Build project # Variables
make files="
src/test/main.c
# Check for 'debug' flag src/*.c
include/*.h
"
compiler="cc"
output="out/why2"
flags="-ljson-c -lcurl"
# Check for debug flag
if [ "$1" == "debug" ]; then if [ "$1" == "debug" ]; then
./out/why2 flags="$flags -g"
echo "Using debug flag"
fi fi
###
echo "Using '$compiler' as default compiler. (Flags: $flags)"
echo "Compiling..."
###
# Compile
$compiler $files $flags -o $output
###
echo "Output generated as '$output'"
###