summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar mszulecki2007-02-23 01:03:11 +0000
committerGravatar mszulecki2007-02-23 01:03:11 +0000
commit9d7a4bddb8e15687c654ab54c8e194fce2f00617 (patch)
treee8b6de694666c32e3173aa7be4fa4d9f39c43b86
parentfdecd53fa0fc7c2a9c85f8c5cd2503d1174d7310 (diff)
downloaddskel-9d7a4bddb8e15687c654ab54c8e194fce2f00617.tar.gz
dskel-9d7a4bddb8e15687c654ab54c8e194fce2f00617.tar.bz2
Add a sample static convenience library.
git-svn-id: http://svn.sukimashita.com/repos/dskel/trunk@13 4281df72-ff29-0410-8fee-2d9ac0c5f5a7
-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";
+ }
+}