Add the Maker build system
[browser-dbus-bridge.git] / build / library.mk
1 include build/common.mk
2 include build/target.mk
3
4 LIBRARY         := lib$(NAME).so$(if $(VERSION),.$(VERSION),)
5 LIBRARY_LINK    := lib$(NAME).so
6 ARCHIVE         := lib$(NAME).a
7
8 O_LIBRARY       := $(O)/lib/$(LIBRARY)
9 O_LIBRARY_LINK  := $(O)/lib/$(LIBRARY_LINK)
10 O_ARCHIVE       := $(O)/lib/$(ARCHIVE)
11
12 build: build-shared build-static
13 build-shared: $(O_LIBRARY)
14 build-static: $(O_ARCHIVE)
15
16 $(O_LIBRARY): $(PIC_OBJECTS) $(DEPENDS)
17         $(call echo,Link,$@)
18         $(QUIET) mkdir -p $(dir $@)
19         $(QUIET) $(LINKCOMMAND) -fPIC -shared -Wl,-soname,$(LIBRARY) \
20                 -o $@ $(PIC_OBJECTS) $(LIBS)
21 ifneq ($(LIBRARY),$(LIBRARY_LINK))
22         $(QUIET) ln -sf $(LIBRARY) $(O_LIBRARY_LINK)
23 endif
24
25 $(O_ARCHIVE): $(OBJECTS)
26         $(call echo,Archive,$@)
27         $(QUIET) mkdir -p $(dir $@)
28         $(QUIET) $(AR) crs $@ $(OBJECTS)
29
30 install::
31 ifneq ($(wildcard $(O_LIBRARY)),)
32         mkdir -p $(DEST_LIBDIR)
33         install $(O_LIBRARY) $(DEST_LIBDIR)/
34         ln -sf $(LIBRARY) $(DEST_LIBDIR)/$(LIBRARY_LINK)
35 endif
36
37 install::
38 ifneq ($(wildcard $(O_ARCHIVE)),)
39         mkdir -p $(DEST_LIBDIR)
40         install $(O_ARCHIVE) $(DEST_LIBDIR)/
41 endif
42
43 .PHONY: build build-shared build-static