From 81117f00d6471f692ff30b07feaecf0ccb314702 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Tue, 11 Nov 2014 23:54:07 +0100 Subject: [PATCH] Added a test for binary targets as well --- Makefile | 3 +++ tests/Makefile | 2 +- tests/binary/Makefile.Darwin | 41 ++++++++++++++++++++++++++++++++++++ tests/binary/Makefile.NetBSD | 41 ++++++++++++++++++++++++++++++++++++ tests/binary/project.conf | 7 ++++++ tests/project.conf | 4 ++-- tests/tests.sh | 2 ++ 7 files changed, 97 insertions(+), 3 deletions(-) create mode 100644 tests/binary/Makefile.Darwin create mode 100644 tests/binary/Makefile.NetBSD create mode 100644 tests/binary/project.conf diff --git a/Makefile b/Makefile index d4c3359..6d39c79 100644 --- a/Makefile +++ b/Makefile @@ -60,6 +60,9 @@ dist: $(PACKAGE)-$(VERSION)/src/project.conf \ $(PACKAGE)-$(VERSION)/tests/Makefile \ $(PACKAGE)-$(VERSION)/tests/tests.sh \ + $(PACKAGE)-$(VERSION)/tests/binary/project.conf \ + $(PACKAGE)-$(VERSION)/tests/binary/Makefile.Darwin \ + $(PACKAGE)-$(VERSION)/tests/binary/Makefile.NetBSD \ $(PACKAGE)-$(VERSION)/tests/library/project.conf \ $(PACKAGE)-$(VERSION)/tests/library/Makefile.Darwin \ $(PACKAGE)-$(VERSION)/tests/library/Makefile.NetBSD \ diff --git a/tests/Makefile b/tests/Makefile index 39abbae..ea057ab 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -10,7 +10,7 @@ INSTALL = install all: $(TARGETS) -$(OBJDIR)tests.log: library/project.conf library/Makefile.Darwin library/Makefile.NetBSD plugin/Makefile.Darwin plugin/Makefile.NetBSD tests.sh +$(OBJDIR)tests.log: binary/project.conf binary/Makefile.Darwin binary/Makefile.NetBSD library/project.conf library/Makefile.Darwin library/Makefile.NetBSD plugin/Makefile.Darwin plugin/Makefile.NetBSD tests.sh ./tests.sh -P "$(PREFIX)" -- "$(OBJDIR)tests.log" clean: diff --git a/tests/binary/Makefile.Darwin b/tests/binary/Makefile.Darwin new file mode 100644 index 0000000..14c4d90 --- /dev/null +++ b/tests/binary/Makefile.Darwin @@ -0,0 +1,41 @@ +TARGETS = $(OBJDIR)test +OBJDIR = +PREFIX = /usr/local +DESTDIR = +BINDIR = $(PREFIX)/bin +SBINDIR = $(PREFIX)/sbin +RM = rm -f +LN = ln -f +MKDIR = mkdir -m 0755 -p +INSTALL = install + + +all: $(TARGETS) + +test_OBJS = $(OBJDIR)test.o $(OBJDIR)main.o +test_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) +test_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) + +$(OBJDIR)test: $(test_OBJS) + $(CC) -o $(OBJDIR)test $(test_OBJS) $(test_LDFLAGS) + +$(OBJDIR)test.o: test.c + $(CC) $(test_CFLAGS) -o $(OBJDIR)test.o -c test.c + +$(OBJDIR)main.o: main.c + $(CC) $(test_CFLAGS) -o $(OBJDIR)main.o -c main.c + +clean: + $(RM) -- $(test_OBJS) + +distclean: clean + $(RM) -- $(TARGETS) + +install: $(TARGETS) + $(MKDIR) $(DESTDIR)$(BINDIR) + $(INSTALL) -m 0755 $(OBJDIR)test $(DESTDIR)$(BINDIR)/test + +uninstall: + $(RM) -- $(DESTDIR)$(BINDIR)/test + +.PHONY: all clean distclean install uninstall diff --git a/tests/binary/Makefile.NetBSD b/tests/binary/Makefile.NetBSD new file mode 100644 index 0000000..14c4d90 --- /dev/null +++ b/tests/binary/Makefile.NetBSD @@ -0,0 +1,41 @@ +TARGETS = $(OBJDIR)test +OBJDIR = +PREFIX = /usr/local +DESTDIR = +BINDIR = $(PREFIX)/bin +SBINDIR = $(PREFIX)/sbin +RM = rm -f +LN = ln -f +MKDIR = mkdir -m 0755 -p +INSTALL = install + + +all: $(TARGETS) + +test_OBJS = $(OBJDIR)test.o $(OBJDIR)main.o +test_CFLAGS = $(CPPFLAGSF) $(CPPFLAGS) $(CFLAGSF) $(CFLAGS) +test_LDFLAGS = $(LDFLAGSF) $(LDFLAGS) + +$(OBJDIR)test: $(test_OBJS) + $(CC) -o $(OBJDIR)test $(test_OBJS) $(test_LDFLAGS) + +$(OBJDIR)test.o: test.c + $(CC) $(test_CFLAGS) -o $(OBJDIR)test.o -c test.c + +$(OBJDIR)main.o: main.c + $(CC) $(test_CFLAGS) -o $(OBJDIR)main.o -c main.c + +clean: + $(RM) -- $(test_OBJS) + +distclean: clean + $(RM) -- $(TARGETS) + +install: $(TARGETS) + $(MKDIR) $(DESTDIR)$(BINDIR) + $(INSTALL) -m 0755 $(OBJDIR)test $(DESTDIR)$(BINDIR)/test + +uninstall: + $(RM) -- $(DESTDIR)$(BINDIR)/test + +.PHONY: all clean distclean install uninstall diff --git a/tests/binary/project.conf b/tests/binary/project.conf new file mode 100644 index 0000000..53d618c --- /dev/null +++ b/tests/binary/project.conf @@ -0,0 +1,7 @@ +targets=test +dist=Makefile + +[test] +type=binary +sources=test.c,main.c +install=$(BINDIR) diff --git a/tests/project.conf b/tests/project.conf index 36951c3..135ecd8 100644 --- a/tests/project.conf +++ b/tests/project.conf @@ -1,7 +1,7 @@ targets=tests.log -dist=Makefile,tests.sh,library/project.conf,library/Makefile.Darwin,library/Makefile.NetBSD,plugin/project.conf,plugin/Makefile.Darwin,plugin/Makefile.NetBSD +dist=Makefile,tests.sh,binary/project.conf,binary/Makefile.Darwin,binary/Makefile.NetBSD,library/project.conf,library/Makefile.Darwin,library/Makefile.NetBSD,plugin/project.conf,plugin/Makefile.Darwin,plugin/Makefile.NetBSD [tests.log] type=script script=./tests.sh -depends=library/project.conf,library/Makefile.Darwin,library/Makefile.NetBSD,plugin/Makefile.Darwin,plugin/Makefile.NetBSD,tests.sh +depends=binary/project.conf,binary/Makefile.Darwin,binary/Makefile.NetBSD,library/project.conf,library/Makefile.Darwin,library/Makefile.NetBSD,plugin/Makefile.Darwin,plugin/Makefile.NetBSD,tests.sh diff --git a/tests/tests.sh b/tests/tests.sh index e66c77d..332c6e5 100755 --- a/tests/tests.sh +++ b/tests/tests.sh @@ -96,7 +96,9 @@ fi target="$1" ($DATE +_test "Darwin" "binary" _test "Darwin" "library" _test "Darwin" "plugin" +_test "NetBSD" "binary" _test "NetBSD" "library" _test "NetBSD" "plugin") > "$target"