xinyangli
2824efad33
NJU-ProjectN/nemu eb63cf3568dbf4e0c3c6ef462e6ec685550fabbc Merge pull request #76 from rijuyuezhu/master
40 lines
845 B
Makefile
40 lines
845 B
Makefile
NAME = conf
|
|
obj := build
|
|
SRCS += confdata.c expr.c preprocess.c symbol.c util.c
|
|
SRCS += $(obj)/lexer.lex.c $(obj)/parser.tab.c
|
|
CC = gcc
|
|
CFLAGS += -DYYDEBUG
|
|
INC_PATH += .
|
|
DISTRO = $(shell cat /etc/os-release | grep PRETTY_NAME | sed 's/PRETTY_NAME=//')
|
|
|
|
ifeq ($(DISTRO),"Gentoo Linux")
|
|
LIBS += -ltinfo
|
|
endif
|
|
|
|
ifeq ($(NAME),conf)
|
|
SRCS += conf.c
|
|
else ifeq ($(NAME),mconf)
|
|
SRCS += mconf.c $(shell find lxdialog/ -name "*.c")
|
|
LIBS += -lncurses
|
|
else
|
|
$(error bad target=$(NAME))
|
|
endif
|
|
|
|
include $(NEMU_HOME)/scripts/build.mk
|
|
|
|
$(obj)/lexer.lex.o: $(obj)/parser.tab.h
|
|
$(obj)/lexer.lex.c: lexer.l $(obj)/parser.tab.h
|
|
@echo + LEX $@
|
|
@flex -o $@ $<
|
|
|
|
$(obj)/parser.tab.c $(obj)/parser.tab.h: parser.y
|
|
@echo + YACC $@
|
|
@bison -v $< --defines=$(obj)/parser.tab.h -o $(obj)/parser.tab.c
|
|
|
|
conf:
|
|
@$(MAKE) -s
|
|
|
|
mconf:
|
|
@$(MAKE) -s NAME=mconf
|
|
|
|
.PHONY: conf mconf
|