Alphanumeric Calculator: Makefile
Posted 10-01-2021 at 07:29 PM by astrogeek
Updated 10-03-2021 at 12:45 PM by astrogeek (meh... tpoys)
Updated 10-03-2021 at 12:45 PM by astrogeek (meh... tpoys)
This post is Part 2 of the Alphanumeric Calculator program group.
Copy the code below into a file named Makefile in your local build directory for this project, the same directory where alphacalc.l and alphacalc.y are located.
Read and follow comment about TABs at top of the file.
I have it configured to build with gcc and -std=c17, although this project does not use any features specific to the c17 standard. If you use a different compiler or an older gcc which is not c17 aware, adjust accordingly (see comments in the file).
Copy the code below into a file named Makefile in your local build directory for this project, the same directory where alphacalc.l and alphacalc.y are located.
Read and follow comment about TABs at top of the file.
I have it configured to build with gcc and -std=c17, although this project does not use any features specific to the c17 standard. If you use a different compiler or an older gcc which is not c17 aware, adjust accordingly (see comments in the file).
Code:
#This file intended for copy/paste from HTML page and must be modified before use #Command lines in targets must be TAB inented and are prefixed with # <TAB> #markers where this is necessary #Replace each occurrance of <TAB> with a literal tab character before use #Example method: # sed -i 's/^<TAB>/\t/' Makefile CC = gcc LEX = flex YACC = bison #Run with DEBUG=1 to produce executable with debug option #If using older gcc safely change -std=c17 to -std=c11, -std=c99 or use default ifdef DEBUG CFLAGS = -g -DYYDEBUG=1 -D_POSIX_C_SOURCE=200809L -std=c17 LEXFLAGS = -d else CFLAGS = -D_POSIX_C_SOURCE=200809L -std=c17 LEXFLAGS = endif PROGRAMS = alphacalc all: ${PROGRAMS} alphacalc: alphacalc.c alphacalc.tab.c <TAB>${CC} ${CFLAGS} $^ -o $@ alphacalc.tab.c alphacalc.tab.h: alphacalc.y <TAB>${YACC} -vd $< #<TAB>${YACC} -vd $< -Wcounterexamples alphacalc.c: alphacalc.l alphacalc.tab.h <TAB>${LEX} ${LEXFLAGS} -o $@ $< clean: <TAB>rm -f *.o alphacalc alphacalc.output alphacalc.tab.c alphacalc.tab.h alphacalc.c
Total Comments 0