From 9d7a4bddb8e15687c654ab54c8e194fce2f00617 Mon Sep 17 00:00:00 2001 From: mszulecki Date: Fri, 23 Feb 2007 01:03:11 +0000 Subject: Add a sample static convenience library. git-svn-id: http://svn.sukimashita.com/repos/dskel/trunk@13 4281df72-ff29-0410-8fee-2d9ac0c5f5a7 --- src/Makefile.am | 15 ++++++++------- src/helloworld.d | 3 ++- src/testlibrary.d | 9 +++++++++ 3 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 src/testlibrary.d diff --git a/src/Makefile.am b/src/Makefile.am index c68ffec..2a97177 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,17 +1,18 @@ -SUFFIXES: .d +noinst_LIBRARIES = libtestlibrary.a +libtestlibrary_a_SOURCES = testlibrary.d +libtestlibrary_a_LDFLAGS = -static bin_PROGRAMS = helloworld - helloworld_SOURCES = helloworld.d -helloworld_LDADD = $(DEPS_LIBS) -helloworld_LINK = $(GDC) $(DFLAGS) -o helloworld $(top_srcdir)/config.d +helloworld_LDADD = $(DEPS_LIBS) $(top_srcdir)/config.d libtestlibrary.a +helloworld_LINK = $(GDC) $(DFLAGS) -o $@ -AM_CPPFLAGS = $(DEPS_CFLAGS) +DFLAGS = -I$(top_srcdir) -I$(srcdir) .d.o: - $(GDC) $(DFLAGS) -I$(top_srcdir) -c -o $@ $< + $(GDC) $(DFLAGS) -c -o $@ $< .d.so: - $(GDC) $(DFLAGS) -I$(top_srcdir) -c -shared -fPIC -o $@ $< + $(GDC) $(DFLAGS) -c -shared -fPIC -o $@ $< DISTCLEANFILES = \ Makefile.in diff --git a/src/helloworld.d b/src/helloworld.d index e1113cc..74f6428 100755 --- a/src/helloworld.d +++ b/src/helloworld.d @@ -1,9 +1,10 @@ import config; +import testlibrary; import std.stdio; void main(char[][] args) { - writefln("Hello World, Version: " ~ config.VERSION); + writefln(HelloWorldFactory.getName() ~ ", Version: " ~ config.VERSION); // auto type inference and built-in foreach foreach (argc, argv; args) diff --git a/src/testlibrary.d b/src/testlibrary.d new file mode 100644 index 0000000..744163b --- /dev/null +++ b/src/testlibrary.d @@ -0,0 +1,9 @@ +module testlibrary; + +public static class HelloWorldFactory +{ + public static char[] getName() + { + return "Hello World"; + } +} -- cgit v1.1-32-gdbae