From a75cb185be236f4d50617142c1c2bfea2ef3b5ae Mon Sep 17 00:00:00 2001 From: Bruce Perens Date: Mon, 25 Oct 2010 17:37:58 -0700 Subject: Add library target, to build a .a file for use in complex projects. Signed-off-by: Perry Hung --- README | 8 ++++++++ build-targets.mk | 8 ++++++++ 2 files changed, 16 insertions(+) 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 -- cgit v1.2.3