📄 makefile
字号:
## ## Simple makefile for CS143 programming projects##.PHONY: clean strip# Set the default target. When you make with no arguments,# this will be the target built.COMPILER = cucPRODUCTS = $(COMPILER) default: $(PRODUCTS)# Set up the list of source and object filesSRCS = ast.cc ast_decl.cc ast_expr.cc ast_stmt.cc ast_type.cc errors.cc utility.cc main.cc# OBJS can deal with either .cc or .c files listed in SRCSOBJS = y.tab.o lex.yy.o $(patsubst %.cc, %.o, $(filter %.cc,$(SRCS))) $(patsubst %.c, %.o, $(filter %.c, $(SRCS)))JUNK = *.o lex.yy.c dpp.yy.c y.tab.c y.tab.h *.core core# Define the tools we are going to useCC= g++LD = g++LEX = flexYACC = bison# Set up the necessary flags for the tools# We want debugging and most warnings, but lex/yacc generate some# static symbols we don't use, so turn off unused warnings to avoid clutter# Also STL has some signed/unsigned comparisons we want to suppressCFLAGS = -g -Wall -Wno-unused -Wno-sign-compare# The -d flag tells lex to set up for debugging. Can turn on/off by# setting value of global yy_flex_debug inside the scanner itselfLEXFLAGS = -d# The -d flag tells yacc to generate header with token types# The -v flag writes out a verbose description of the states and conflicts# The -t flag turns on debugging capability# The -y flag means imitate yacc's output file naming conventionsYACCFLAGS = -dvty# Link with standard c library, math library, and lex libraryLIBS = -lc -lm -ll# Rules for various parts of the target.yy.o: $*.yy.c $(CC) $(CFLAGS) -c -o $@ $*.cclex.yy.c: scanner.l parser.y y.tab.h $(LEX) $(LEXFLAGS) scanner.ly.tab.o: y.tab.c $(CC) $(CFLAGS) -c -o y.tab.o y.tab.cy.tab.h y.tab.c: parser.y $(YACC) $(YACCFLAGS) parser.y.cc.o: $*.cc $(CC) $(CFLAGS) -c -o $@ $*.cc# rules to build compiler (dcc)$(COMPILER) : $(OBJS) $(LD) -o $@ $(OBJS) $(LIBS)# This target is to build small for testing (no debugging info), removes# all intermediate products, toostrip : $(PRODUCTS) strip $(PRODUCTS) rm -rf $(JUNK)# make depend will set up the header file dependencies for the # assignment. You should make depend whenever you add a new header# file to the project or move the project between machines#depend: makedepend -- $(CFLAGS) -- $(SRCS)clean: rm -f $(JUNK) y.output $(PRODUCTS)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -