./0040755000076400001440000000000007701144372010264 5ustar gholtusers./Makeppfile0100644000076400001440000000612307701144327012263 0ustar gholtusers# # This makefile tests variable expansion as completely as we can. # .PHONY: all targets := colon_equal_test patsubst_test rc_expansion shell_command \ misc_gnu_make_functions user_func question_equal_test rc_test \ filename_test all: $(targets) # # Check the difference between := and regular variables, and test the # += construct. # V1P_NOCOLON = 0 V1P_COLON := 0 V12 = 1 V1_NOCOLON = $(V12) # Initially equal to 1, then finally equal to 2. V1P_NOCOLON += $(V12) # Should expand to "0 2" at the end. V1P_COLON += $(V12) # Should expand to "0 1" at the end. V1_COLON := $(V12) # Should be equal to 1. V12 = 2 V2_COLON := $(V12) # Should be equal to 2. colon_equal_test: echo $(V1_NOCOLON) $(V2_NOCOLON) > $@ echo ${V1_COLON} $(V2_COLON) >> $@ echo $(V1P_NOCOLON) $(V1P_COLON) >> $@ X = 1 QUESEQ ?= 1 $(X) QUESEQ ?= 2 $(X) X = 2 question_equal_test: echo $(QUESEQ) > $@ # # Check the pattern substitution operator. # P = a.o b.o c.o d.o Q = ax.o ay.o az.o patsubst_test: echo $(patsubst %.o, %.c, $(P)) > $@ echo ${P:.o=.c} >> $@ echo $(patsubst a%.o, b%.c, $(Q)) >> $@ echo $(Q:a%.o=b%.c) >> $@ # # Check RC-style expansion # rc_expansion: echo "a$(P)b" > $@ echo z$(patsubst %.o, %.c, a$(P))y >> $@ echo a$( b c d)e >> $@ # # Check running shell commands: # SHELLVAR != echo Percy Bryce Shell shell_command: echo "$(shell echo she sells Bourne shells)" > $@; \ echo $(shell echo by the C shore) >> $@ echo $(SHELLVAR) >> $@ # # Quick check on miscellaneous GNU-make style functions: # misc_gnu_make_functions: echo $(basename mydir.with.periods/version-1.0-module.c) \ $(basename subdir/xyz) > $@ echo $(notdir some/directories/here/file) >> $@ echo $(addprefix a, b c d e) >> $@ echo $(addsuffix a, b c d e) >> $@ echo $(dir abc/def/ghi file-without-dir) >> $@ echo $(filter %.c %.s, foo.c bar.c baz.s ugh.h) >> $@ # From GNU make docs. echo $(filter-out main1.o main2.o,main1.o foo.o main2.o bar.o) >> $@ echo $(findstring a,a b c) x$(findstring a,b c)y >> $@ echo $(firstword word1 word2 word3) >> $@ echo $(sort a b c a q v b) >> $@ echo '"$(strip a b c )"' >> $@ echo $(subst :, ,a:b:c) >> $@ echo $(suffix src/foo.c src-1.0/bar.c hacks) >> $@ echo $(word 2, foo bar baz) >> $@ echo $(wordlist 2, 3, foo bar baz) >> $@ echo $(words a b c) >> $@ echo $(if , $(print echo generated error), b) $(if true, c, $(print echo generated error)) >> $@ # Above test checks for partial evaluation if the if operands. echo $(foreach var, 1 2 3 4 5 6, number $(var)) >> $@ echo $(join a b c, .o .c) >> $@ echo $(origin RM) $(origin ^) $(origin I_hope_this_is_undefined) $(origin inputs) $(origin PATH) $(origin V12) >> $@ # # Test of rc-style substitution: # rc_test: rc_off/rc_off_test echo prefix_$( a b c d)_suffix > $@ cat $^ >> $@ # # Test of relative and absolute filenames: # filename_test: echo $(relative_filename rc_off/.././././test) > $@ echo $(relative_to a rc_off/Makeppfile, rc_off) >> $@ # # User defined function: # sub f_my_func { return "a$_[0]b"; } user_func: echo $(my_func $(P)) > $@ $(phony clean): rm -rf $(targets) *~ .makepp* rc_off/rc_off_test rc_off/.makepp* ./rc_off/0040755000076400001440000000000007701144372011522 5ustar gholtusers./rc_off/Makeppfile0100644000076400001440000000033607300525750013517 0ustar gholtusers# # Test substitution with rc-style substitution turned off.n # rc_substitution = 0 words := a b c d e null := X := a $(null) # X has a trailing space. rc_off_test: echo prefix_$(words)_suffix > $@ echo $(X)a >> $@ ./answers/0040755000076400001440000000000007701144364011747 5ustar gholtusers./answers/rc_test0100644000076400001440000000013407300526004013316 0ustar gholtusersprefix_a_suffix prefix_b_suffix prefix_c_suffix prefix_d_suffix prefix_a b c d e_suffix a a ./answers/patsubst_test0100644000076400001440000000007607142360007014567 0ustar gholtusersa.c b.c c.c d.c a.c b.c c.c d.c bx.c by.c bz.c bx.c by.c bz.c ./answers/rc_expansion0100644000076400001440000000010007143076470014350 0ustar gholtusersaa.ob ab.ob ac.ob ad.ob zaa.cy zab.cy zac.cy zad.cy abe ace ade ./answers/misc_gnu_make_functions0100644000076400001440000000045007701144217016554 0ustar gholtusersmydir.with.periods/version-1.0-module subdir/xyz file ab ac ad ae ba ca da ea abc/def/ ./ foo.c bar.c baz.s foo.o bar.o a xy word1 a b c q v "a b c" a b c c c bar bar baz 3 b c number 1 number 2 number 3 number 4 number 5 number 6 a.o b.c c default automatic undefined automatic environment file ./answers/colon_equal_test0100644000076400001440000000001607142352760015224 0ustar gholtusers2 1 2 0 2 0 1 ./answers/n_files0100644000076400001440000000000307675136672013314 0ustar gholtusers10 ./answers/question_equal_test0100644000076400001440000000000407152631167015760 0ustar gholtusers1 2 ./answers/shell_command0100644000076400001440000000007107152630605014470 0ustar gholtusersshe sells Bourne shells by the C shore Percy Bryce Shell ./answers/user_func0100644000076400001440000000002207142363120013642 0ustar gholtusersaa.o b.o c.o d.ob