moved Makefile function into build.sh
This commit is contained in:
parent
02606e5a09
commit
39796b634e
14
Makefile
14
Makefile
@ -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
|
37
build.sh
37
build.sh
@ -1,12 +1,39 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Remove versions.json
|
||||
####################
|
||||
|
||||
# Remove previous output & versions.json
|
||||
rm -rf out/*
|
||||
rm -f versions.json
|
||||
|
||||
# Build project
|
||||
make
|
||||
# Variables
|
||||
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
|
||||
./out/why2
|
||||
flags="$flags -g"
|
||||
echo "Using debug flag"
|
||||
fi
|
||||
|
||||
###
|
||||
echo "Using '$compiler' as default compiler. (Flags: $flags)"
|
||||
echo "Compiling..."
|
||||
###
|
||||
|
||||
# Compile
|
||||
$compiler $files $flags -o $output
|
||||
|
||||
###
|
||||
echo "Output generated as '$output'"
|
||||
###
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user