default: ; This is the testfile for MKE. ; ; The default command itself test that some basic functions of MKE ; works, along with some conditional processing of command files. ; ; There are a number of different tests you can perform. ; All have descriptions on how to perform them. ; ; If you just run the test, the description about the test ; will be printed. ; ; If the RUN variable is defined, the test will instead ; be run. ; ; To run a test, type MKE /MAK=TEST[/DEF=(RUN)] TESTn ; ; List of tests: ; ; Test0 - Test different variables that always should exist. ; Test1 - Test direct dependency loops ; Test2 - Test indirect dependency loops ; Test3 - Test command modifiers ; Test4 - Test temporary command files ; Test5 - Test conditional execution ; Test6 - Test exit status and .PRINT ; Test7 - Test line expansion splitting ; Test8 - Test variable expansion with modifiers ; Test9 - Test of continuation lines ; test0: .ifndef run ; Test0 - Test different variables that always should exist. ; ; Prints out a number of values. Just check that they look ; right, and you don't get any errors. .else ; Your operating system is $(OS) ($(OSID)) ; CLI is $(CLI) ; Current directory is $(CWD) ; Current UIC is $(UIC) ; Protection UIC is $(DUIC) .if $(osid) == 6 ; SYSUIC: $(SYSUIC) ; LIBUIC: $(LIBUIC) ; NETUIC: $(NETUIC) ; System name: $(SYSNAM) .endif ; ; Target is $@ ; Short target is $. ; Sources are $> ; First source is $< ; Changed sources are $? ; ; Sources separated by comma: {$>} ; Sources with suffix: {$(>:/FOO)} test0: test01 test.mke makefile. test01: test.mke: makefile.: .endif test1: .ifndef run ; Test1 - Test direct dependency loops ; ; When run, MKE should abort while reading the makefile, claiming ; that FOO depends on FOO. .else .if make(test1) foo: foo .endif .endif test2: .ifndef run ; Test2 - Test indirect dependency loops ; ; When run, MKE should abort with a loop detected during build. .else test2: foo foo: test2 .endif test3: .ifndef run ; Test3 - Test command modifiers ; ; When run, MKE should tell the expected result, and then ; perform the command for a number of commands. .else ; Testing to perform a line without echo. ; Doing a SET /UIC hidden... @SET /UIC ; Doing a SET /UIC protected from errors. -SET /UIC ; Doing a SET /UIC protected and hidden. @-SET /UIC ; One more -@SET /UIC ; Now try a command we know will cause an error, but ; we protect ourself. -MAC NL:=FOO.TMP;32767 ; Now we try the command without protection. ; This should terminate MKE. MAC NL:=FOO.TMP;32767 .endif test4: .ifndef run ; Test4 - Test temporary command files ; ; This will do a silly thing with IND just to check ; that we can. .else \@ ; This is echoed through IND. ^Z .endif test5: .ifndef run ; Test5 - Test conditional execution ; ; When run, this test will check that some lines ; aren't executed. .else ; This line is executed. ; Next line should also be executed: .if 1 ; This line is inside a conditional. .endif ; The next line should not be executed, and will produce ; an error, if executed... .if 0 MAC NL:=FOO.MAC;32767 .endif ; If we get here, everything works fine. .endif test6: .ifndef run ; Test 6 - Checking exit status variable and .PRINT ; ; When run, this will check that the exit status is returned, ; and looks correct. .else -PIP NL:=NL: .PRINT "Exit status is " $(EXSTAT) " (should be 1)" ; A silly error line. -PIP FOO.BAR;/DE .PRINT "Exit status is " $(EXSTAT) " (should be <> 1)" -MAC NL:=X.Z .PRINT "Exit status is " $(EXSTAT) " (should be <> 1)" ; Also test .PRINT ; _FOO is $(_FOO) .PRINT "_FOO is " $(_FOO) _FOO=kaka hex .endif test7: .ifndef run ; Test7 - Test line splitting ; ; Line splitting is used to make sure lines don't exceed ; either 80 characters, nor a maximum number of parameters ; on one line. .else _TST7 = abc def ghi jkl mno pqr stu vwx yza bcd efg hij klm nop qrs tuv wxy _TST7 += zab cde fgh ijk lmn opq rst uvw xyz ; Testing line splitting. ; This line should not exceed 80 chars: {$(_TST7)} ; This line should have no more than 7 args: {:7$(_TST7)} .endif test8: .ifndef run ; Test8 - Test variable expansion with modifiers ; ; This test will expand variables with different modifiers, ; both single and combined modifiers. .else _TST8 = foo1.bar foo2.bar foo3.baz foo4.baz ; First of all, the varible value is: $(_TST8) ; Now just the first value: $(_TST8:1) ; Now all .bar replaced with .foo: $(_TST8:.BAR.FOO) ; Now all .bar removed: $(_TST8:.BAR) ; Now only the .bar files: $(_TST8:=.BAR) ; Now only the .bar files, without extensions: $(_TST8:=.BAR:.BAR) ; Now only the first .baz file: $(_TST8:=.BAZ:1) ; Now an undefined variable: $(KEX:Uundef) ; Done. .endif test9: .ifndef run ; Test9 - Test of continuation lines ; ; This test defines a variable in multiple lines, which ; should be just fine. .else _TST9 = foo \ bar \ quux ; The (long) variable is $(_TST9) .endif