# Reverse Polish Notation, syntax.y # © 2001, Michael Piefel <piefel@informatik.hu-berlin.de> .PRECIOUS: lexic.c y.output # Tools SHELL = /bin/sh YACC = bison LEX = flex CC = ${CXX} KC = kc++ #Flages YFLAGS = -d -y LFLAGS = -t CXXFLAGS = -g -Wall -Wno-unused -DYYDEBUG -DYYERROR_VERBOSE CFLAGS = ${CXXFLAGS} # Sources KFILES = rpn.k main.k abs.k CFILES = YFILES = syntax.y LFILES = lexic.l # Goals PARSER = rpn-parser # Help files KC_TIME = .kc_time_stamp KC_OGEN = k.o csgiok.o unpk.o rk.o KC_OSRC = $(KFILES:.k=.o) OBJS = $(KC_OGEN) $(KC_OSRC) $(YFILES:.y=.o) $(LFILES:.l=.o) $(CFILES:.cc=.o) # default rule $(PARSER):: # include or make autodependencies ifeq (.depend,$(wildcard .depend)) include .depend else $(PARSER):: depend endif # Rules $(KC_TIME): $(KFILES) $(KC) $(KFILES) touch $(KC_TIME) $(PARSER):: $(KC_TIME) $(OBJS) $(CXX) $(CFLAGS) $(OBJS) ${LIBS} -o $@ syntax.h : y.tab.h -cmp -s syntax.h y.tab.h || cp y.tab.h syntax.h y.tab.h : syntax.c depend dep: @echo Make dependencies first $(MAKE) $(KC_TIME) #$(MAKE) $(CFILES) $(MAKE) $(YFILES:.y=.c) $(MAKE) $(LFILES:.l=.c) $(MAKE) syntax.h $(CC) -M *.cc > .depend clean: -rm -f $(OBJS) core *~ *.bak $(KFILES:.k=.cc) $(KC_OGEN:.o=.cc) $(KC_TIME) .kc* \ $(YFILES:.y=.c) $(LFILES:.l=.c) $(KC_OGEN:.o=.h) $(KFILES:.k=.h) out.* \ y.tab.h