aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Perens <bruce@perens.com>2010-10-25 17:37:58 -0700
committerPerry Hung <iperry@gmail.com>2010-10-25 21:19:40 -0400
commita75cb185be236f4d50617142c1c2bfea2ef3b5ae (patch)
tree8165e00db93c6d3f99280c0376db624289168116
parent6c956a383834b66c29591294f0926ced22f3e3b7 (diff)
downloadlibrambutan-a75cb185be236f4d50617142c1c2bfea2ef3b5ae.tar.gz
librambutan-a75cb185be236f4d50617142c1c2bfea2ef3b5ae.zip
Add library target, to build a .a file for use in complex projects.
Signed-off-by: Perry Hung <iperry@gmail.com>
-rw-r--r--README8
-rw-r--r--build-targets.mk8
2 files changed, 16 insertions, 0 deletions
diff --git a/README b/README
index 5e88e11..b7dd521 100644
--- a/README
+++ b/README
@@ -70,3 +70,11 @@ maple-library folder (macosx and windows).
Write your program using /main.cpp as the entry point. Then just 'make help'
and follow the directions!
+Instructions to create a library
+------------------------------------------------------------------------------
+If you have a complicated project with its own Makefile and multiple .c files,
+or you're using an IDE that creates its own Makefile, you'll probably want to
+load libmaple from an archive (a build-time library, not a DLL). Use the
+"make library" target, and install build/libmaple.a and the appropriate headers
+in your project's directory. At a minimum, the header set will include
+libmaple.h, util.h, and libmaple_types.h
diff --git a/build-targets.mk b/build-targets.mk
index 448b1ee..0718b15 100644
--- a/build-targets.mk
+++ b/build-targets.mk
@@ -2,6 +2,14 @@
$(BUILD_PATH)/main.o: main.cpp
$(SILENT_CXX) $(CXX) $(CFLAGS) $(CXXFLAGS) $(LIBMAPLE_INCLUDES) $(WIRISH_INCLUDES) -o $@ -c $<
+$(BUILD_PATH)/libmaple.a: $(BUILDDIRS) $(TGT_BIN)
+ - rm -f $@
+ $(AR) crv $(BUILD_PATH)/libmaple.a $(TGT_BIN)
+
+library: $(BUILD_PATH)/libmaple.a
+
+.PHONY: library
+
$(BUILD_PATH)/$(BOARD).elf: $(BUILDDIRS) $(TGT_BIN) $(BUILD_PATH)/main.o
$(SILENT_LD) $(CXX) $(LDFLAGS) -o $@ $(TGT_BIN) $(BUILD_PATH)/main.o