i think the compiler is working
This commit is contained in:
parent
670871345e
commit
0d666fb853
8
Makefile
8
Makefile
@ -1,5 +1,9 @@
|
|||||||
all:
|
all:
|
||||||
flex compiler/hell.l
|
flex compiler/hell.l
|
||||||
gcc lex.yy.c -lfl
|
gcc lex.yy.c -lfl -o hellp
|
||||||
|
install:
|
||||||
|
install hellp /usr/bin
|
||||||
clean:
|
clean:
|
||||||
rm lex.yy.c a.out
|
rm lex.yy.c hellp
|
||||||
|
uninstall:
|
||||||
|
rm /usr/bin/hellp
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
INFILE=${2}
|
INFILE=${2}
|
||||||
|
OUTFILE=${3}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
printf "${0} - compiler for HELL programming language\n"
|
printf "${0} - compiler for HELL programming language\n"
|
||||||
@ -13,7 +14,7 @@ usage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
usage_small() {
|
usage_small() {
|
||||||
printf "usage: ${0} INFILE GCCOPTS\n"
|
printf "usage: ${0} [-h] [-c] INFILE OUTFILE\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
case ${1} in
|
case ${1} in
|
||||||
@ -33,14 +34,18 @@ case ${1} in
|
|||||||
printf "${0}: error: HELL preprocessor failed to run\n"
|
printf "${0}: error: HELL preprocessor failed to run\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
printf "${0}: hellp: ran successfully\n"
|
||||||
|
|
||||||
printf "compiling ${INFILE}\n"
|
printf "compiling ${INFILE}\n"
|
||||||
gcc ${INFILE}.new -o ${INFILE}
|
gcc -x c ${INFILE}.new -o ${OUTFILE}
|
||||||
if [ "$?" != 0 ]; then
|
if [ "$?" != 0 ]; then
|
||||||
printf "${0}: error: C compiler failed to run\n"
|
printf "${0}: error: C compiler failed to run\n"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
printf "cleaning up\n"
|
||||||
|
rm -v ${INFILE}.new
|
||||||
|
|
||||||
printf "finished compiling\n"
|
printf "finished compiling\n"
|
||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
Loading…
Reference in New Issue
Block a user