Skip to content

Instantly share code, notes, and snippets.

@infosec-intern
Created August 22, 2016 23:30
Show Gist options
  • Save infosec-intern/12923c9d7fb44b86df42bdbebff464ed to your computer and use it in GitHub Desktop.
Save infosec-intern/12923c9d7fb44b86df42bdbebff464ed to your computer and use it in GitHub Desktop.
New exercise and skeleton Makefile scripts - makes creating new exercises easier for LearnCTheHardWay
CFLAGS=-Wall -g
EX=
all:
make ${EX}
ec:
gcc ${CFLAGS} -o ec extracredit.c
broken:
gcc ${CFLAGS} -o broken broken.c
clean:
rm -f ${EX} broken ec
#!/bin/bash
EX="$1"
SKEL="#include <stdio.h>\n
\n
int main(int argc, char *argv[])\n
{\n
\treturn 0;\n
}"
mkdir $EX
cat Makefile | sed -e "s/EX=/EX=$EX/" > $EX/Makefile
echo -e $SKEL > $EX/$EX.c
echo -e $SKEL > $EX/broken.c
echo -e $SKEL > $EX/extracredit.c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment