aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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