📄 vpathplus
字号:
# -*-perl-*-#$Id: vpathplus,v 1.3 2005/12/18 02:05:45 rockyb Exp $$description = "Tests the new VPATH+ functionality added in 3.76.";$details = "";$VP = "$workdir$pathsep";open(MAKEFILE,"> $makefile");# The Contents of the MAKEFILE ...print MAKEFILE "VPATH = $VP\n";print MAKEFILE <<'EOMAKE';SHELL = /bin/sh.SUFFIXES: .a .b .c .d.PHONY: general rename notarget intermediate%.a:%.b:%.c:%.d:%.a : %.b cat $^ > $@%.b : %.c cat $^ > $@ 2>/dev/null || exit 1%.c :: %.d cat $^ > $@# General testing info:general: foo.bfoo.b: foo.c bar.c# Rename testing info:rename: $(VPATH)/foo.c foo.d# Target not made testing info:notarget: notarget.bnotarget.c: notarget.d -@echo "not creating $@ from $^"# Intermediate files:intermediate: inter.aEOMAKEclose(MAKEFILE);@touchedfiles = ();$off = -500;sub touchfiles { foreach (@_) { &utouch($off, $_); $off += 10; push(@touchedfiles, $_); }}# Run the general-case test&touchfiles("$VP/foo.d", "$VP/bar.d", "$VP/foo.c", "$VP/bar.c", "foo.b", "bar.d");&run_make_with_options($makefile,"general --basename-filenames",&get_logfile);push(@touchedfiles, "bar.c");$answer = "cat bar.d > bar.ccat ${VP}foo.c bar.c > foo.b 2>/dev/null || exit 1";&compare_output($answer,&get_logfile(1));# Test rules that don't make the target correctly&touchfiles("$VP/notarget.c", "notarget.b", "notarget.d");&run_make_with_options($makefile,"notarget --basename-filenames", &get_logfile, 512);$answer = "not creating notarget.c from notarget.dcat notarget.c > notarget.b 2>/dev/null || exit 1work/features/vpathplus.mk:16: *** [notarget.b] Error 1#0 notarget.b at work/features/vpathplus.mk:16#1 notarget (.PHONY target)Command-line arguments: \"-f work/features/vpathplus.mk notarget --basename-filenames\"";&compare_output($answer,&get_logfile(1));# Test intermediate file handling (part 1)&touchfiles("$VP/inter.d");&run_make_with_options($makefile,"intermediate",&get_logfile);push(@touchedfiles, "inter.a", "inter.b");$answer = "cat ${VP}inter.d > inter.ccat inter.c > inter.b 2>/dev/null || exit 1cat inter.b > inter.arm inter.b inter.c";&compare_output($answer,&get_logfile(1));# Test intermediate file handling (part 2)&utouch(-20, "inter.a");&utouch(-10, "$VP/inter.b");&touch("$VP/inter.d");push(@touchedfiles, "$VP/inter.b", "$VP/inter.d");&run_make_with_options($makefile,"intermediate",&get_logfile);$answer = "cat ${VP}inter.d > inter.ccat inter.c > inter.b 2>/dev/null || exit 1cat inter.b > inter.arm inter.c";&compare_output($answer,&get_logfile(1));unlink @touchedfiles unless $keep;1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -