summaryrefslogtreecommitdiff
path: root/examples/hello_subdirs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/hello_subdirs')
-rw-r--r--examples/hello_subdirs/Makefile3
-rw-r--r--examples/hello_subdirs/Makefile.inc1
-rw-r--r--examples/hello_subdirs/prog1/Makefile14
-rw-r--r--examples/hello_subdirs/prog1/expect.out36
-rwxr-xr-xexamples/hello_subdirs/prog1/prog1.awk6
-rw-r--r--examples/hello_subdirs/prog1/prog1.c7
-rwxr-xr-xexamples/hello_subdirs/prog1/prog1.sh3
-rw-r--r--examples/hello_subdirs/prog1/test.mk37
-rw-r--r--examples/hello_subdirs/prog2/Makefile9
-rw-r--r--examples/hello_subdirs/prog2/expect.out26
-rw-r--r--examples/hello_subdirs/prog2/prog2.c7
-rw-r--r--examples/hello_subdirs/prog2/test.mk35
12 files changed, 184 insertions, 0 deletions
diff --git a/examples/hello_subdirs/Makefile b/examples/hello_subdirs/Makefile
new file mode 100644
index 0000000..3847c12
--- /dev/null
+++ b/examples/hello_subdirs/Makefile
@@ -0,0 +1,3 @@
+SUBDIR = prog1 prog2
+
+.include <mkc.subdir.mk>
diff --git a/examples/hello_subdirs/Makefile.inc b/examples/hello_subdirs/Makefile.inc
new file mode 100644
index 0000000..01b5f23
--- /dev/null
+++ b/examples/hello_subdirs/Makefile.inc
@@ -0,0 +1 @@
+.include "../Makefile.inc"
diff --git a/examples/hello_subdirs/prog1/Makefile b/examples/hello_subdirs/prog1/Makefile
new file mode 100644
index 0000000..d103cbe
--- /dev/null
+++ b/examples/hello_subdirs/prog1/Makefile
@@ -0,0 +1,14 @@
+PROG = prog1
+SCRIPTS = prog1.sh prog1.awk
+
+WARNS = 4
+
+# Do not set SCRIPTSNAME in project's Makefile!
+# This is just a regression test.
+SCRIPTSNAME_prog1.awk = program1.awk
+SCRIPTSNAME_prog1.sh = program1.sh
+
+SCRIPTSDIR_prog1.sh = ${PREFIX}/libexec
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_subdirs/prog1/expect.out b/examples/hello_subdirs/prog1/expect.out
new file mode 100644
index 0000000..fe11252
--- /dev/null
+++ b/examples/hello_subdirs/prog1/expect.out
@@ -0,0 +1,36 @@
+Hello World1
+Hello World1-2
+Hello World1-3
+OBJDIR_prog1=/path/to/prog1
+OBJDIR_prog2=/path/to/prog2
+=========== all ============
+/objdir/Makefile
+/objdir/expect.out
+/objdir/prog1
+/objdir/prog1.awk
+/objdir/prog1.c
+/objdir/prog1.o
+/objdir/prog1.sh
+/objdir/prog1.test.out.tmp
+/objdir/test.mk
+========= install ==========
+/objdir/prefix/bin/prog1
+/objdir/prefix/bin/program1.awk
+/objdir/prefix/libexec/program1.sh
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/prog1.awk
+/objdir/prog1.c
+/objdir/prog1.sh
+/objdir/prog1.test.out.tmp
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/prog1.awk
+/objdir/prog1.c
+/objdir/prog1.sh
+/objdir/prog1.test.out.tmp
+/objdir/test.mk
diff --git a/examples/hello_subdirs/prog1/prog1.awk b/examples/hello_subdirs/prog1/prog1.awk
new file mode 100755
index 0000000..5a03ed8
--- /dev/null
+++ b/examples/hello_subdirs/prog1/prog1.awk
@@ -0,0 +1,6 @@
+#!/usr/bin/awk -f
+
+BEGIN {
+ print "Hello World1-3"
+ exit 0
+}
diff --git a/examples/hello_subdirs/prog1/prog1.c b/examples/hello_subdirs/prog1/prog1.c
new file mode 100644
index 0000000..33fd57f
--- /dev/null
+++ b/examples/hello_subdirs/prog1/prog1.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+ puts ("Hello World1");
+ return 0;
+}
diff --git a/examples/hello_subdirs/prog1/prog1.sh b/examples/hello_subdirs/prog1/prog1.sh
new file mode 100755
index 0000000..43d6573
--- /dev/null
+++ b/examples/hello_subdirs/prog1/prog1.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+echo Hello World1-2
diff --git a/examples/hello_subdirs/prog1/test.mk b/examples/hello_subdirs/prog1/test.mk
new file mode 100644
index 0000000..d62c501
--- /dev/null
+++ b/examples/hello_subdirs/prog1/test.mk
@@ -0,0 +1,37 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ ${.OBJDIR}/prog1; \
+ ${.OBJDIR}/prog1.sh; \
+ ${.OBJDIR}/prog1.awk; \
+ \
+ echo OBJDIR_prog1=${OBJDIR_prog1} | mkc_test_helper_paths; \
+ echo OBJDIR_prog2=${OBJDIR_prog2} | mkc_test_helper_paths; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKE_FLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKE_FLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKE_FLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKE_FLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>
diff --git a/examples/hello_subdirs/prog2/Makefile b/examples/hello_subdirs/prog2/Makefile
new file mode 100644
index 0000000..ebf00fa
--- /dev/null
+++ b/examples/hello_subdirs/prog2/Makefile
@@ -0,0 +1,9 @@
+PROG = prog2
+WARNS = 4
+
+# Do not set PROGNAME in project's Makefile!
+# This is just a regression test.
+PROGNAME = program2
+
+.include "test.mk"
+.include <mkc.prog.mk>
diff --git a/examples/hello_subdirs/prog2/expect.out b/examples/hello_subdirs/prog2/expect.out
new file mode 100644
index 0000000..8730e19
--- /dev/null
+++ b/examples/hello_subdirs/prog2/expect.out
@@ -0,0 +1,26 @@
+Hello World2
+OBJDIR_prog1=/path/to/prog1
+OBJDIR_prog2=/path/to/prog2
+=========== all ============
+/objdir/Makefile
+/objdir/expect.out
+/objdir/prog2
+/objdir/prog2.c
+/objdir/prog2.o
+/objdir/prog2.test.out.tmp
+/objdir/test.mk
+========= install ==========
+/objdir/prefix/bin/program2
+======== uninstall =========
+========== clean ===========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/prog2.c
+/objdir/prog2.test.out.tmp
+/objdir/test.mk
+======= distclean ==========
+/objdir/Makefile
+/objdir/expect.out
+/objdir/prog2.c
+/objdir/prog2.test.out.tmp
+/objdir/test.mk
diff --git a/examples/hello_subdirs/prog2/prog2.c b/examples/hello_subdirs/prog2/prog2.c
new file mode 100644
index 0000000..314960b
--- /dev/null
+++ b/examples/hello_subdirs/prog2/prog2.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+int main (int argc, char **argv)
+{
+ puts ("Hello World2");
+ return 0;
+}
diff --git a/examples/hello_subdirs/prog2/test.mk b/examples/hello_subdirs/prog2/test.mk
new file mode 100644
index 0000000..e86aa9c
--- /dev/null
+++ b/examples/hello_subdirs/prog2/test.mk
@@ -0,0 +1,35 @@
+.PHONY : test_output
+test_output:
+ @set -e; \
+ rm -rf ${.OBJDIR}${PREFIX}; \
+ ${.OBJDIR}/prog2; \
+ \
+ echo OBJDIR_prog1=${OBJDIR_prog1} | mkc_test_helper_paths; \
+ echo OBJDIR_prog2=${OBJDIR_prog2} | mkc_test_helper_paths; \
+ \
+ echo =========== all ============; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ========= install ==========; \
+ ${MAKE} ${MAKE_FLAGS} install DESTDIR=${.OBJDIR} \
+ > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"; \
+ \
+ echo ======== uninstall =========; \
+ ${MAKE} ${MAKE_FLAGS} uninstall DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR}${PREFIX} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ========== clean ===========; \
+ ${MAKE} ${MAKE_FLAGS} clean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}";\
+ \
+ echo ======= distclean ==========; \
+ ${MAKE} ${MAKE_FLAGS} distclean DESTDIR=${.OBJDIR} > /dev/null; \
+ find ${.OBJDIR} -type f -o -type l | \
+ mkc_test_helper "${PREFIX}" "${.OBJDIR}"
+
+.include <mkc.minitest.mk>