11da177e4SLinus TorvaldsPROG= aicasm 21da177e4SLinus Torvalds 31da177e4SLinus Torvalds.SUFFIXES= .l .y .c .h 41da177e4SLinus Torvalds 51da177e4SLinus TorvaldsCSRCS= aicasm.c aicasm_symbol.c 61da177e4SLinus TorvaldsYSRCS= aicasm_gram.y aicasm_macro_gram.y 71da177e4SLinus TorvaldsLSRCS= aicasm_scan.l aicasm_macro_scan.l 81da177e4SLinus Torvalds 91da177e4SLinus TorvaldsGENHDRS= aicdb.h $(YSRCS:.y=.h) 101da177e4SLinus TorvaldsGENSRCS= $(YSRCS:.y=.c) $(LSRCS:.l=.c) 111da177e4SLinus Torvalds 121da177e4SLinus TorvaldsSRCS= ${CSRCS} ${GENSRCS} 131da177e4SLinus TorvaldsLIBS= -ldb 141da177e4SLinus Torvaldsclean-files:= ${GENSRCS} ${GENHDRS} $(YSRCS:.y=.output) $(PROG) 151da177e4SLinus Torvalds# Override default kernel CFLAGS. This is a userland app. 161da177e4SLinus TorvaldsAICASM_CFLAGS:= -I/usr/include -I. 17*dba654d1SSam RavnborgLEX= flex 18*dba654d1SSam RavnborgYACC= bison 191da177e4SLinus TorvaldsYFLAGS= -d 201da177e4SLinus Torvalds 211da177e4SLinus TorvaldsNOMAN= noman 221da177e4SLinus Torvalds 231da177e4SLinus Torvaldsifneq ($(HOSTCC),) 241da177e4SLinus TorvaldsAICASM_CC= $(HOSTCC) 251da177e4SLinus Torvaldselse 261da177e4SLinus TorvaldsAICASM_CC= $(CC) 271da177e4SLinus Torvaldsendif 281da177e4SLinus Torvalds 291da177e4SLinus Torvaldsifdef DEBUG 301da177e4SLinus TorvaldsCFLAGS+= -DDEBUG -g 311da177e4SLinus TorvaldsYFLAGS+= -t -v 321da177e4SLinus TorvaldsLFLAGS= -d 331da177e4SLinus Torvaldsendif 341da177e4SLinus Torvalds 351da177e4SLinus Torvalds$(PROG): ${GENHDRS} $(SRCS) 361da177e4SLinus Torvalds $(AICASM_CC) $(AICASM_CFLAGS) $(SRCS) -o $(PROG) $(LIBS) 371da177e4SLinus Torvalds 381da177e4SLinus Torvaldsaicdb.h: 391da177e4SLinus Torvalds @if [ -e "/usr/include/db4/db_185.h" ]; then \ 401da177e4SLinus Torvalds echo "#include <db4/db_185.h>" > aicdb.h; \ 411da177e4SLinus Torvalds elif [ -e "/usr/include/db3/db_185.h" ]; then \ 421da177e4SLinus Torvalds echo "#include <db3/db_185.h>" > aicdb.h; \ 431da177e4SLinus Torvalds elif [ -e "/usr/include/db2/db_185.h" ]; then \ 441da177e4SLinus Torvalds echo "#include <db2/db_185.h>" > aicdb.h; \ 451da177e4SLinus Torvalds elif [ -e "/usr/include/db1/db_185.h" ]; then \ 461da177e4SLinus Torvalds echo "#include <db1/db_185.h>" > aicdb.h; \ 471da177e4SLinus Torvalds elif [ -e "/usr/include/db/db_185.h" ]; then \ 481da177e4SLinus Torvalds echo "#include <db/db_185.h>" > aicdb.h; \ 491da177e4SLinus Torvalds elif [ -e "/usr/include/db_185.h" ]; then \ 501da177e4SLinus Torvalds echo "#include <db_185.h>" > aicdb.h; \ 511da177e4SLinus Torvalds else \ 521da177e4SLinus Torvalds echo "*** Install db development libraries"; \ 531da177e4SLinus Torvalds fi 541da177e4SLinus Torvalds 551da177e4SLinus Torvaldsclean: 561da177e4SLinus Torvalds rm -f $(clean-files) 571da177e4SLinus Torvalds 581da177e4SLinus Torvalds# Create a dependency chain in generated files 591da177e4SLinus Torvalds# to avoid concurrent invocations of the single 601da177e4SLinus Torvalds# rule that builds them all. 611da177e4SLinus Torvaldsaicasm_gram.c: aicasm_gram.h 621da177e4SLinus Torvaldsaicasm_gram.c aicasm_gram.h: aicasm_gram.y 631da177e4SLinus Torvalds $(YACC) $(YFLAGS) -b $(<:.y=) $< 641da177e4SLinus Torvalds mv $(<:.y=).tab.c $(<:.y=.c) 651da177e4SLinus Torvalds mv $(<:.y=).tab.h $(<:.y=.h) 661da177e4SLinus Torvalds 671da177e4SLinus Torvalds# Create a dependency chain in generated files 681da177e4SLinus Torvalds# to avoid concurrent invocations of the single 691da177e4SLinus Torvalds# rule that builds them all. 701da177e4SLinus Torvaldsaicasm_macro_gram.c: aicasm_macro_gram.h 711da177e4SLinus Torvaldsaicasm_macro_gram.c aicasm_macro_gram.h: aicasm_macro_gram.y 721da177e4SLinus Torvalds $(YACC) $(YFLAGS) -b $(<:.y=) -p mm $< 731da177e4SLinus Torvalds mv $(<:.y=).tab.c $(<:.y=.c) 741da177e4SLinus Torvalds mv $(<:.y=).tab.h $(<:.y=.h) 751da177e4SLinus Torvalds 761da177e4SLinus Torvaldsaicasm_scan.c: aicasm_scan.l 771da177e4SLinus Torvalds $(LEX) $(LFLAGS) -o$@ $< 781da177e4SLinus Torvalds 791da177e4SLinus Torvaldsaicasm_macro_scan.c: aicasm_macro_scan.l 801da177e4SLinus Torvalds $(LEX) $(LFLAGS) -Pmm -o$@ $< 81