Skip to content

Instantly share code, notes, and snippets.

@xxami
Created July 8, 2020 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xxami/c26839abbd6c4fd055c60fe76b84c3f8 to your computer and use it in GitHub Desktop.
Save xxami/c26839abbd6c4fd055c60fe76b84c3f8 to your computer and use it in GitHub Desktop.
version: '2'
vars:
cc: cc
cflags: -std=c18 -pedantic -Wall -fstack-protector-strong -O2
tasks:
build:
silent: true
cmds:
- |
set -e
csources=""
for file in src/*.c; do
if test -f $file; then
csources+="$file "
fi
done
for file in src/*/*.c; do
if test -f $file; then
csources+="$file "
fi
done
if [[ ! -z $csources ]] then
echo "compiling..."
echo {{.cc}} {{.cflags}} -c $csources
{{.cc}} {{.cflags}} -c $csources
else
echo "compile error... no c sources found"
fi
- task: link
sources:
- ./src/*.c
- ./src/**/*.c
generates:
- xdi{{exeExt}}
link:
silent: true
cmds:
- |
set -e
objs=""
for file in *.o; do
if test -f $file; then
objs+="$file "
fi
done
if [[ ! -z "$objs" ]] then
echo "linking..."
echo {{.cc }} {{.cflags}} -o xdi{{exeExt}} $objs
{{.cc}} {{.cflags}} -o xdi{{exeExt}} $objs
rm *.o
else
echo "link error... no obj files found"
fi
run:
cmds:
- task: build
- ./xdi{{exeExt}}
clean:
ignore_error: true
silent: true
cmds:
- rm xdi{{exeExt}}
- rm *.exe
- rm *.dll
- rm *.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment