Update build tests
authorMarko Kreen <markokr@gmail.com>
Tue, 20 Dec 2011 21:27:08 +0000 (23:27 +0200)
committerMarko Kreen <markokr@gmail.com>
Tue, 20 Dec 2011 21:28:34 +0000 (23:28 +0200)
14 files changed:
mk/temos/expected/antimake1.txt
mk/temos/expected/antimake2.txt
mk/temos/expected/antimake3.txt
mk/temos/expected/antimake4.txt
mk/temos/expected/antimake5.txt
mk/temos/expected/antimake6.txt
mk/temos/expected/libusual1.txt
mk/temos/src/antimake1.temo
mk/temos/src/antimake2.temo
mk/temos/src/antimake3.temo
mk/temos/src/antimake4.temo
mk/temos/src/antimake5.temo
mk/temos/src/antimake6.temo
mk/temos/src/libusual1.temo

index 9ee516524df96c020c566da796f9c2972fe62a64..91f4d754702d1e2628564be252a659ab2a2e5eae 100644 (file)
@@ -63,10 +63,10 @@ Hello, world
 We can even install it already:
 
 ---------------------------------
-$ make install prefix=/opt
-     INSTALL  hello /opt/bin
-$ ls /opt/bin
-hello  prog
+$ make install prefix=/opt DESTDIR=./inst
+     INSTALL  hello ./inst/opt/bin
+$ ls ./inst/opt/bin
+hello
 ---------------------------------
 
 For creating source package, we need to provide additional info:
@@ -95,7 +95,7 @@ $ make dist
      COPY     myhello-1.0
      PACK     myhello-1.0.tar.gz
 $ ls
-Makefile  antimake.mk  hello  hello.c  myhello-1.0.tar.gz
+Makefile  antimake.mk  hello  hello.c  inst  myhello-1.0.tar.gz
 $ tar tzf myhello-1.0.tar.gz | sort
 myhello-1.0/
 myhello-1.0/Makefile
@@ -109,7 +109,7 @@ Clean the tree
 $ make clean
      CLEAN    hello
 $ ls
-Makefile  antimake.mk  hello.c myhello-1.0.tar.gz
+Makefile  antimake.mk  hello.c inst  myhello-1.0.tar.gz
 ---------------------------------
 
 Done!
index abd4e873bf098af477178edc61ed8e955d6a12f4..971d1716d8ac68ab6a350c1e20db7f3fc28e7f98 100644 (file)
@@ -22,10 +22,18 @@ $ cp ../../antimake.mk .
 
 Prepare sources
 
+.File: api.h
+[source,c]
+-----------------------------------
+void func1(void);
+void func2(void);
+void func3(void);
+-----------------------------------
 .File: main.c
 [source,c]
 -----------------------------------
 #include <stdio.h>
+#include "api.h"
 
 int main(void)
 {
@@ -40,6 +48,7 @@ int main(void)
 [source,c]
 -----------------------------------
 #include <stdio.h>
+#include "api.h"
 
 void func1(void)
 {
@@ -50,6 +59,7 @@ void func1(void)
 [source,c]
 -----------------------------------
 #include <stdio.h>
+#include "api.h"
 
 void func2(void)
 {
@@ -60,6 +70,7 @@ void func2(void)
 [source,c]
 -----------------------------------
 #include <stdio.h>
+#include "api.h"
 
 void func3(void)
 {
@@ -93,6 +104,7 @@ SUBDIRS = sublib
 
 noinst_LIBRARIES = func1.a
 func1_a_SOURCES = func1.c
+func1_a_CPPFLAGS = -I..
 
 EXTRA_DIST = Makefile
 
@@ -105,6 +117,7 @@ SUBLOC = lib1/sublib
 
 noinst_LIBRARIES = func2.a
 func2_a_SOURCES = func2.c
+func2_a_CPPFLAGS = -I../..
 
 EXTRA_DIST = Makefile
 
@@ -117,6 +130,7 @@ SUBLOC = lib2
 
 noinst_LIBRARIES = func3.a
 func3_a_SOURCES = func3.c
+func3_a_CPPFLAGS = -I$(top_srcdir)
 
 EXTRA_DIST = Makefile
 
@@ -148,7 +162,7 @@ $ make
      CC       main.c
      CCLD     prog
 $ ls
-Makefile  antimake.mk  lib1  lib2  main.c  prog
+Makefile  antimake.mk  api.h  lib1  lib2  main.c  prog
 $ ./prog
 func1
 func2
@@ -156,10 +170,10 @@ func3
 main
 ---------------------------------
 
-We can even install it already:
+We can now install it:
 
 ---------------------------------
-$ make install prefix=/opt
+$ make install DESTDIR=./inst
      -->      lib1
      -->      lib1/sublib
 make[2]: Nothing to be done for `install'.
@@ -168,9 +182,9 @@ make[2]: Nothing to be done for `install'.
      -->      lib2
 make[1]: Nothing to be done for `install'.
      <--      lib2
-     INSTALL  prog /opt/bin
-$ ls /opt/bin
-hello  prog
+     INSTALL  prog ./inst/usr/local/bin
+$ ls ./inst/usr/local/bin
+prog
 ---------------------------------
 
 Now we can create package that can be given to others.
@@ -182,7 +196,8 @@ $ make dist
      COPY     test-subdirs-1.0
      PACK     test-subdirs-1.0.tar.gz
 $ ls
-Makefile  antimake.mk  lib1  lib2  main.c  prog  test-subdirs-1.0.tar.gz
+Makefile     api.h  lib1  main.c  test-subdirs-1.0.tar.gz
+antimake.mk  inst   lib2  prog
 $ tar tzf test-subdirs-1.0.tar.gz | sort
 test-subdirs-1.0/
 test-subdirs-1.0/Makefile
@@ -214,7 +229,7 @@ $ make clean
      <--      lib2
      CLEAN    prog
 $ ls
-Makefile  antimake.mk  lib1  lib2  main.c  test-subdirs-1.0.tar.gz
+Makefile  antimake.mk  api.h  inst  lib1  lib2 main.c  test-subdirs-1.0.tar.gz
 ---------------------------------
 
 Test O=
@@ -243,7 +258,8 @@ $ make O=build
      CC       ../main.c
      CCLD     prog
 $ ls
-Makefile  antimake.mk  build  lib1  lib2  main.c  test-subdirs-1.0.tar.gz
+Makefile     api.h  inst  lib2   test-subdirs-1.0.tar.gz
+antimake.mk  build  lib1  main.c
 $ ls build
 Makefile  antimake.mk  lib1  lib2  prog
 ---------------------------------
index 87dc7b2f385449325c463001fc89f6d34107693c..484a745f27f044656d6202c7181693ab920c39f3 100644 (file)
@@ -103,6 +103,10 @@ Prepare sources
 -----------------------------------
 #include <stdio.h>
 
+void func1(void);
+void func2(void);
+void func3(void);
+
 int main(void)
 {
        func1();
@@ -209,13 +213,13 @@ func3
 main
 ---------------------------------
 
-We can even install it already:
+We can now install it:
 
 ---------------------------------
-$ make install prefix=/opt
-     INSTALL  prog /opt/bin
-$ ls /opt/bin
-hello  prog
+$ make install prefix=/opt DESTDIR=./inst
+     INSTALL  prog ./inst/opt/bin
+$ ls ./inst/opt/bin
+prog
 ---------------------------------
 
 Now we can create package that can be given to others.
@@ -227,7 +231,8 @@ $ make dist
      COPY     test-subdirs-1.0
      PACK     test-subdirs-1.0.tar.gz
 $ ls
-Makefile  antimake.mk  lib1  lib2  main.c  prog  src  test-subdirs-1.0.tar.gz
+Makefile     inst  lib2    prog  test-subdirs-1.0.tar.gz
+antimake.mk  lib1  main.c  src
 $ tar tzf test-subdirs-1.0.tar.gz | sort
 test-subdirs-1.0/
 test-subdirs-1.0/Makefile
@@ -254,7 +259,7 @@ $ make clean
      CLEAN    lib2/func3.a
      CLEAN    clean
 $ ls
-Makefile  antimake.mk  lib1  lib2  main.c  src test-subdirs-1.0.tar.gz
+Makefile  antimake.mk  inst  lib1  lib2  main.c  src  test-subdirs-1.0.tar.gz
 ---------------------------------
 
 Done!
index 49138885f7b3ebbc09191d71ef9fdde32d012cc8..849688ca02ce0b3c14908afc637cbdc93831adc4 100644 (file)
@@ -7,10 +7,7 @@ Autoconf setup
 .File: autogen.sh
 [source,shell]
 -----------------------------------
-libtoolize -i -q
-aclocal -I../../../m4
-autoconf
-rm -rf autom4te.cache ltmain.sh aclocal.m4
+../../std-autogen.sh ../../..
 
 # fetch Antimake template from libusual
 cp ../../antimake.mk antimake.mk.in
index 59ce1025cb6488aa00da51ac84e22e6b379468c2..ef94b36e6a1b9b84976a01454653ad9ebb5daca0 100644 (file)
@@ -7,10 +7,7 @@ Autoconf setup
 .File: autogen.sh
 [source,shell]
 -----------------------------------
-libtoolize -i -q
-aclocal -I../../../m4
-autoconf
-rm -rf autom4te.cache aclocal.m4
+../../std-autogen.sh ../../..
 
 # fetch Antimake template from libusual
 cp ../../antimake.mk antimake.mk.in
@@ -47,6 +44,7 @@ int main(void)
 -----------------------------------
 #include <stdio.h>
 
+void func1(void);
 void func1(void)
 {
        printf("hello from func1\n");
index 1bfdfd64cd37e95bd1b972874c27381967b2402c..f0a1b5d8a4f47cea5995e53be712b525f1ca528b 100644 (file)
@@ -7,10 +7,7 @@ Autoconf setup
 .File: autogen.sh
 [source,shell]
 -----------------------------------
-libtoolize -i -q
-aclocal -I../../../m4
-autoconf
-rm -rf autom4te.cache aclocal.m4
+../../std-autogen.sh ../../..
 
 # fetch Antimake template from libusual
 grep -Ei '@[a-z_]+@' ../../antimake.mk > build.mk.in
@@ -116,6 +113,8 @@ Now fill makefiles
 SUBDIRS = sub
 EMBED_SUBDIRS = esub
 
+override WFLAGS = -Wall
+
 EXTRA_DIST = Makefile antimake.mk $(MAINTAINERCLEANFILES)
 
 # clean configured files
@@ -389,28 +388,28 @@ Clean up
 
 ---------------------------------
 $ make maintainer-clean
-     CLEAN    esub/libfunc4.a
-     CLEAN    esub/esub/libfunc6.a
-     CLEAN    cpptest
-     CLEAN    esub/prog
      -->      sub
-     CLEAN    libfunc1.a
-     CLEAN    esub/libfunc2.a
      -->      sub/sub
      CLEAN    libfunc3.a
      <--      sub/sub
+     CLEAN    libfunc1.a
+     CLEAN    esub/libfunc2.a
      CLEAN    clean
      <--      sub
      -->      esub/sub
      CLEAN    libfunc5.a
      <--      esub/sub
+     CLEAN    esub/libfunc4.a
+     CLEAN    esub/esub/libfunc6.a
+     CLEAN    cpptest
+     CLEAN    esub/prog
      CLEAN    clean
      -->      sub
-     CLEAN    libfunc1.a
-     CLEAN    esub/libfunc2.a
      -->      sub/sub
      CLEAN    libfunc3.a
      <--      sub/sub
+     CLEAN    libfunc1.a
+     CLEAN    esub/libfunc2.a
      CLEAN    clean
      -->      sub/sub
      CLEAN    libfunc3.a
index c8b64901991f59f06675b87db6a998774b7d0ceb..2959397b66b7f97670953117946eb175ebaa4536 100644 (file)
@@ -19,11 +19,11 @@ done.
 $ cd lib
 $ ./autogen.sh
 [...]
-$ ./configure --disable-shared --prefix=/home/marko/src/libusual/mk/temos/tmp/lib/../inst
+$ ./configure --disable-shared --prefix=/opt
 [...]
 $ make
 [...]
-$ make install
+$ make install DESTDIR=`pwd`/../inst
 [...]
 $ cd ..
 ---------------------------------
@@ -64,8 +64,8 @@ SRCS = prog.c
 OBJS = $(SRCS:.c=.o)
 
 # here we link to libusual
-CPPFLAGS = -I./inst/include
-LDFLAGS = -L./inst/lib
+CPPFLAGS = -I./inst/opt/include
+LDFLAGS = -L./inst/opt/lib
 LIBS = -lusual
 
 CC = gcc
@@ -81,8 +81,8 @@ Build the project
 
 ---------------------------------
 $ make
-gcc -O -g -Wall -I./inst/include  -c -o prog.o prog.c
-gcc -O -g -Wall -L./inst/lib prog.o -lusual -o prog
+gcc -O -g -Wall -I./inst/opt/include  -c -o prog.o prog.c
+gcc -O -g -Wall -L./inst/opt/lib prog.o -lusual -o prog
 $ ls
 Makefile  inst lib  prog  prog.c  prog.o
 $ ./prog
index a13d576994c0e00687170a775409b4807865185b..8c2742ef3cf6f7c9923b58bbd6b9b62fadb273ff 100644 (file)
@@ -47,8 +47,8 @@ run ls
 run ./hello
 
 msg We can even install it already:
-run make install prefix=/opt
-run ls /opt/bin
+run make install prefix=/opt DESTDIR=./inst
+run ls ./inst/opt/bin
 
 msg For creating source package, we need to provide additional info:
 
index c7144b44114c9dfe726a6754a2f81d79673964cb..79bc4aed424a3a8c8f324b608c094d73c759190c 100644 (file)
@@ -23,8 +23,15 @@ run cp ../../antimake.mk .
 
 msg Prepare sources
 
+cat_file api.h <<"EOF"
+       void func1(void);
+       void func2(void);
+       void func3(void);
+EOF
+
 cat_file main.c <<"EOF"
        #include <stdio.h>
+       #include "api.h"
 
        int main(void)
        {
@@ -38,6 +45,7 @@ EOF
 
 cat_file lib1/func1.c <<"EOF"
        #include <stdio.h>
+       #include "api.h"
 
        void func1(void)
        {
@@ -47,6 +55,7 @@ EOF
 
 cat_file lib1/sublib/func2.c <<"EOF"
        #include <stdio.h>
+       #include "api.h"
 
        void func2(void)
        {
@@ -56,6 +65,7 @@ EOF
 
 cat_file lib2/func3.c <<"EOF"
        #include <stdio.h>
+       #include "api.h"
 
        void func3(void)
        {
@@ -86,6 +96,7 @@ cat_file lib1/Makefile <<"EOF"
 
        noinst_LIBRARIES = func1.a
        func1_a_SOURCES = func1.c
+       func1_a_CPPFLAGS = -I..
 
        EXTRA_DIST = Makefile
 
@@ -97,6 +108,7 @@ cat_file lib1/sublib/Makefile <<"EOF"
 
        noinst_LIBRARIES = func2.a
        func2_a_SOURCES = func2.c
+       func2_a_CPPFLAGS = -I../..
 
        EXTRA_DIST = Makefile
 
@@ -108,6 +120,7 @@ cat_file lib2/Makefile <<"EOF"
 
        noinst_LIBRARIES = func3.a
        func3_a_SOURCES = func3.c
+       func3_a_CPPFLAGS = -I$(top_srcdir)
 
        EXTRA_DIST = Makefile
 
@@ -122,9 +135,9 @@ run make
 run ls
 run ./prog
 
-msg We can even install it already:
-run make install prefix=/opt
-run ls /opt/bin
+msg We can now install it:
+run make install DESTDIR=./inst
+run ls ./inst/usr/local/bin
 
 msg Now we can create package that can be given to others.
 run make dist
index 8fd4b9b76423f54a5c89ee2793d3c6a2da4b35db..b191f997a4bf4f0b7dd205a27c297aa1b03ffb9b 100644 (file)
@@ -93,6 +93,10 @@ msg Prepare sources
 cat_file main.c <<"EOF"
        #include <stdio.h>
 
+       void func1(void);
+       void func2(void);
+       void func3(void);
+
        int main(void)
        {
                func1();
@@ -175,9 +179,9 @@ run make
 run ls
 run ./prog
 
-msg We can even install it already:
-run make install prefix=/opt
-run ls /opt/bin
+msg We can now install it:
+run make install prefix=/opt DESTDIR=./inst
+run ls ./inst/opt/bin
 
 msg Now we can create package that can be given to others.
 run make dist
index d59751183200023a20740b81e333ebfb9056c5d0..da299a1e040190fd22d446d64cc9d10c6cdf5a19 100644 (file)
@@ -8,10 +8,7 @@ title Using Antimake with autoconf
 msg Autoconf setup
 
 cat_file autogen.sh <<"EOF"
-       libtoolize -i -q
-       aclocal -I../../../m4
-       autoconf
-       rm -rf autom4te.cache ltmain.sh aclocal.m4
+       ../../std-autogen.sh ../../..
 
        # fetch Antimake template from libusual
        cp ../../antimake.mk antimake.mk.in
index 8880681ecdd1bfb8cf461bdb4b9f150ddc71c9f9..a6c3c22e76342c92460bff85f9f9bb2a02a7d398 100644 (file)
@@ -8,10 +8,7 @@ title Shared libraries and autoconf
 msg Autoconf setup
 
 cat_file autogen.sh <<"EOF"
-       libtoolize -i -q
-       aclocal -I../../../m4
-       autoconf
-       rm -rf autom4te.cache aclocal.m4
+       ../../std-autogen.sh ../../..
 
        # fetch Antimake template from libusual
        cp ../../antimake.mk antimake.mk.in
@@ -44,6 +41,7 @@ EOF
 cat_file func.c <<"EOF"
        #include <stdio.h>
 
+       void func1(void);
        void func1(void)
        {
                printf("hello from func1\n");
index 3c3a256cbb40632ef0b055cae2ed53a23263ab02..aee99bdafbbbd038027871ab348ebc1a3c47d9e4 100644 (file)
@@ -8,10 +8,7 @@ title Antimake stress-test
 msg Autoconf setup
 
 cat_file autogen.sh <<"EOF"
-       libtoolize -i -q
-       aclocal -I../../../m4
-       autoconf
-       rm -rf autom4te.cache aclocal.m4
+       ../../std-autogen.sh ../../..
 
        # fetch Antimake template from libusual
        grep -Ei '@[a-z_]+@' ../../antimake.mk > build.mk.in
@@ -109,6 +106,8 @@ cat_file Makefile <<"EOF"
        SUBDIRS = sub
        EMBED_SUBDIRS = esub
 
+       override WFLAGS = -Wall
+
        EXTRA_DIST = Makefile antimake.mk $(MAINTAINERCLEANFILES)
 
        # clean configured files
index 41d984930bf4768f087dcfb4ee80d859947a311d..97c894435c7b296c7d34dace8afedaf97d0d92f2 100644 (file)
@@ -21,9 +21,9 @@ usual_clone lib
 run cd lib
 
 runq ./autogen.sh
-runq ./configure --disable-shared --prefix=`pwd`/../inst
+runq ./configure --disable-shared --prefix=/opt
 runq make
-runq make install
+runq make install 'DESTDIR=`pwd`/../inst'
 
 run cd ..
 
@@ -55,8 +55,8 @@ cat_file Makefile <<"EOF"
        OBJS = $(SRCS:.c=.o)
 
        # here we link to libusual
-       CPPFLAGS = -I./inst/include
-       LDFLAGS = -L./inst/lib
+       CPPFLAGS = -I./inst/opt/include
+       LDFLAGS = -L./inst/opt/lib
        LIBS = -lusual
 
        CC = gcc