diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2010-03-05 08:13:25 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2010-06-11 07:02:18 +0000 |
commit | 3ec82a5a420fc00d38ad7dded819525a91533652 (patch) | |
tree | 84016128e65001e4aed1d45a1402b2fb2375c385 /Make.rules | |
parent | 60b537e356dfcd0ed9a3516152c6a170912efcef (diff) | |
download | apk-tools-3ec82a5a420fc00d38ad7dded819525a91533652.tar.gz apk-tools-3ec82a5a420fc00d38ad7dded819525a91533652.tar.bz2 apk-tools-3ec82a5a420fc00d38ad7dded819525a91533652.tar.xz apk-tools-3ec82a5a420fc00d38ad7dded819525a91533652.zip |
First steps for libapk
Diffstat (limited to 'Make.rules')
-rw-r--r-- | Make.rules | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -70,7 +70,7 @@ INSTALL := install INSTALLDIR := $(INSTALL) -d CFLAGS ?= -g -O2 -CFLAGS_ALL := -Werror -Wall -Wstrict-prototypes -D_GNU_SOURCE -std=gnu99 +CFLAGS_ALL := -Werror -Wall -Wstrict-prototypes -D_GNU_SOURCE -std=gnu99 -fPIC CFLAGS_ALL += $(CFLAGS) LDFLAGS ?= -g @@ -197,6 +197,24 @@ $(obj)/%.o: $(src)/%.c FORCE $(call if_changed_rule,cc_o_c) ##### +# Link shared libraries +# +__shlibs := $(addprefix $(obj)/,$(sort $(shlibs-y))) +shobjs := $(addprefix $(obj)/,$(sort $(foreach m,$(shlibs-y),$($(m)-objs)))) + +# link shared library +quiet_cmd_shlib = LD -shared $@ + cmd_shlib = $(CC) $(ld_flags) -shared -o $@ \ + $(addprefix $(obj)/,$($(@F)-objs)) \ + $(LIBS) $(LIBS_$(@F)) + +$(__shlibs): override local-target-prereqs=$(addprefix $(obj)/,$($(*F)-objs)) + +$(__shlibs): $(obj)/%: $(shobjs) FORCE + $(call if_changed,shlib) + +targets += $(__shlibs) $(shobjs) +##### # Link programs # Link an executable based on list of .o files, all plain c @@ -256,7 +274,7 @@ ifeq ($(toplevelrun),yes) \( -name '*.[oas]' -o -name '.*.cmd' -o -name '.*.d' \) \ -type f -print | xargs rm -f endif - $(Q)rm -rf $(addprefix $(obj)/,$(sort $(progs-y) $(progs-n) $(progs-))) + $(Q)rm -rf $(addprefix $(obj)/,$(sort $(progs-y) $(progs-n) $(progs-) $(shlibs-y) $(shlibs-n) $(shlibs-))) ifeq ($(origin VERSION),command line) DIST_VERSION=$(VERSION) |