summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am15
-rwxr-xr-xsrc/helloworld.d3
-rw-r--r--src/testlibrary.d9
3 files changed, 19 insertions, 8 deletions
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";
+ }
+}