Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/lib/libexpr/Makefile
1808 views
/*
 * expression library
 */

:PACKAGE: ast

LICENSE = since=1989,author=gsf

CCFLAGS = $(CC.OPTIMIZE) $(CC.SUFFIX.DYNAMIC:@?$(CC.DLL)??)

/* NOTE: --mam bug in -I for exparse.c if exparse.y not first */

expr 2.0 :LIBRARY: RELEASE expr.h exlib.h exgram.h exparse.y \
		excc.c excontext.c exdata.c exeval.c exexpr.c \
		exerror.c exopen.c exrewind.c extoken.c extype.c \
		exnospace.c exstash.c exzero.c

/* internal compiler error: in gen_lowpart_general, at rtlhooks.c:59 */
"*.i386*" :NOOPTIMIZE: exeval.c exzero.c

exop.h : exparse.h
	{
	echo 'static const char* exop[] = {'
	echo '	"MINTOKEN",'
	$(SED) -e '1,/MINTOKEN/d' -e '/MAXTOKEN/,$d' -e 's/^[ 	]*//' -e 's/^#[ 	]*define[ 	]*//' -e 's/[= 	].*//' -e 's/.*/	"&",/'
	echo '	"MAXTOKEN",'
	echo '};'
	} < $(*) > $(<)

$(INCLUDEDIR) :INSTALLPROTO: expr.h

$(INCLUDEDIR) :INSTALLDIR: exparse.h

:YYPREFIX: ex ast.h exparse.y

/*
 * NOTE: the solaris yacc botches the yyact[] indices (large positive)
 */

YACC.BOTCH.PATTERN = ',[0-9][0-9][0-9][0-9][0-9]*,'

YACC.BOTCH.FIX : .VIRTUAL .FORCE .AFTER
	if	$(GREP) -c $(YACC.BOTCH.PATTERN) $(<<:N=*.c) >/dev/null
	then	: $(YACC) is botched : yyact indices are bogus :
		$(CP) $(<<:N=*.c:/^/O/:T=F) $(<<:N=*.c)
		$(CP) $(<<:N=*.h:/^/O/:T=F) $(<<:N=*.h)
	else	for i in $(<<:N=*.h) $(<<:N=*.c)
		do	$(SED) -e '1i\
/* : : generated by a yacc that works -- solaris take note : : */' -e '/^[ 	]*#[ 	]*[il][di][en][ne][t]*[ 	]["0-9].*/s,,/* & */,' -e '/^[ 	]*#[ 	]*include[ 	]*"exlib\.h"/i\
#ifndef gettxt\
#define gettxt(h,t)	(t)\
#endif' $i > O$i
		done
	fi

%.c %.h : %.y YACC.BOTCH.FIX

:SAVE: Oexparse.c Oexparse.h