Version 4.0.0.1, tag libreoffice-4.0.0.1
[LibreOffice.git] / dmake / tests / function_macros-2
blobc17501f2aa5d441c79e8220860d00fae4f2f8ee4
1 #!/bin/sh
3 # 01.06.2005 Volker Quetschke
4 # Tests for dmake function macros - part 2.
5 # (issue 36027, issue 37053, issue 37491)
7 : ${DMAKEPROG:=dmake}
8 file1="mymakefile.mk"
9 tmpfiles="$file1"
11 trap '{ echo "trapped signal - removing temporary files" ; rm -rf $tmpfiles ; }' 1 2 3 15
13 trap 'rm -rf $tmpfiles' 1 2 3 15
15 # Remember to quote variables in generated makefiles( $ -> \$ ).
16 cat > $file1 <<EOT
17 # Testing function macros
18 SHELL*:=/bin/sh
19 SHELLFLAGS*:=-ce
21 TEST1:=a b c
22 PAT:=Z
24 all:
25 +@echo -e '\n\$\$(shell ...) section'
26 +test ":123:" = ":\$(shell echo 123 ):"
27 +test ":123:" = ":\$(shell \
28 echo 123 ):"
29 +test ":123:" = ":\$(shell echo \
30 123 ):"
32 +@echo -e '\n\$\$(sort ...) section'
33 +test ":a b c:" = ":\$(sort c a b ):"
34 +test ":a b c:" = ":\$(sort\
35 c a b ):"
36 +test ":a b c:" = ":\$(sort c \
37 a b ):"
39 +@echo -e '\n\$\$(strip ...) section'
40 +test ":c a b:" = ":\$(strip c a b ):"
41 +test ":c a b:" = ":\$(strip c \
42 a b ):"
44 +@echo -e '\n\$\$(subst ...) section'
45 +test ":aZbZc:" = ":\$(subst,\$(SPACECHAR),\$(PAT) \$(TEST1)):"
46 +test ":aZbZc:" = ":\$(subst,%Z*Z%,\$(PAT) \$(TEST1:s/ /%Z*Z%/)):"
47 +test ":aZbZc:" = ":\$(subst,Y,\$(PAT) aYbYc ):"
48 +test ":aZbZc:" = ":{\$(subst,Y,Z aYbYc )}:"
49 # Undefined
50 # +test ":Should error out:BUG:\$(subst, ,\$(PAT) \$(TEST1)):"
52 +@echo -e '\n\$\$(uniq ...) section'
53 +test ":a b c:" = ":\$(uniq c a b c ):"
54 +test ":a b c:" = ":\$(uniq c \
55 a b c ):"
57 EOT
59 ${DMAKEPROG} -r -f $file1
60 result=$?
62 test $result -eq 0 && echo "Success - Cleaning up" && rm -f ${tmpfiles}
63 test $result -ne 0 && echo "Failure!"
64 exit $result