From 61e3ccf7d4bc013750421566cbe08c775b0c3001 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Fri, 10 Nov 2006 23:55:55 +0100 Subject: [PATCH] even better --- am/footer.mk | 41 ++++++++++++++++++++++++++++++++++------- madtty/Makefile | 8 +++++++- 2 files changed, 41 insertions(+), 8 deletions(-) diff --git a/am/footer.mk b/am/footer.mk index 7a7d3b5..d367017 100644 --- a/am/footer.mk +++ b/am/footer.mk @@ -31,21 +31,48 @@ endef deps_create = $(foreach f,$(AUTO_DEPENDS),$(call $f,$1,$2)) +install-LIBRARIES/%:: + mkdir -p $($*dir) + cp $($*_LIBRARIES:=.so) $($*dir) + +uninstall-LIBRARIES/%:: + rm -f $(patsubst %,$($*dir)/%.so,$($*_LIBRARIES)) + rmdir -p $($*dir) || true 2> /dev/null + define CLASS_LIBRARIES_tpl all:: $1.so +install-LIBRARIES/$2:: $1.so + +install:: install-LIBRARIES/$2 +uninstall:: uninstall-LIBRARIES/$2 $1.so: $(_cobjs)/$1/.exists $$(call deps_create,$$($1_SOURCES),$(_cobjs)/$1) $(CC) $$(CFLAGS) $$($1_CPPFLAGS) -fPIC -shared -o $$@ \ $$(filter %.o,$$^) $$(LDFLAGS) $$($1_LDFLAGS) $$($1_LIBADD) -$$(eval $$(call RULE_C_tpl,$1,-fPIC $2)) +$$(eval $$(call RULE_C_tpl,$1,-fPIC)) clean:: $(RM) $1.so endef -$(foreach l, \ - $(foreach l,$(filter %_LIBRARIES,$(.VARIABLES)),$($l)), \ - $(eval $(call CLASS_LIBRARIES_tpl,$l,))) +$(foreach v,$(filter %_LIBRARIES,$(.VARIABLES)), \ + $(foreach x,$($v),$(eval $(call CLASS_LIBRARIES_tpl,$x,$(v:_LIBRARIES=))))) + + +install-DATA/%:: + mkdir -p $($*dir) + cp $($*_DATA) $($*dir) + +uninstall-DATA/%:: + rm -f $(patsubst %,$($*dir)/%,$($*_DATA)) + rmdir -p $($*dir) || true 2> /dev/null + +define CLASS_DATA_tpl +install:: install-DATA/$2 +uninstall:: uninstall-DATA/$2 +endef +$(foreach v,$(filter %_DATA,$(.VARIABLES)), \ + $(foreach x,$($v),$(eval $(call CLASS_DATA_tpl,$x,$(v:_DATA=))))) #define CLASS_EXE_tpl #all:: $1 @@ -89,16 +116,16 @@ all check clobber distclean:: CLEAN_RECURSE=1 clean:: - $(RM) -r $(_cobjs) + $(RM) -r $(_cobjs) $(CLEANFILES) @$(if $(CLEAN_RECURSE),$(patsubst %,$(MAKE) -rC % $@;,$(SUBDIRS))) clobber distclean:: CLEAN_RECURSE= clobber distclean:: clean - $(RM) -r .objs* $(patsubst %.in,%,$(wildcard *.in)) + $(RM) -r .objs* $(DISTCLEANFILES) ifeq (".","$(DEPTH)") clobber distclean:: $(RM) $(patsubst %.in,%,$(wildcard $(CONFDIR)/*.in)) endif -.PHONY: all check clean clobber distclean FORCE +.PHONY: all check clean clobber distclean install FORCE diff --git a/madtty/Makefile b/madtty/Makefile index da4af4c..10e9765 100644 --- a/madtty/Makefile +++ b/madtty/Makefile @@ -1,11 +1,17 @@ DEPTH=.. include $(DEPTH)/am/header.mk +DISTCLEANFILES = madtty.pc + +pkgconfigdir=$(libdir)/pkgconfig +pkgconfig_DATA = madtty.pc + lib_LIBRARIES = libmadtty libmadtty_SOURCES = inject.c inject_csi.c inject_csi.h madtty.h rote.c rote_keymap.c roteprivate.h libmadtty_CPPFLAGS = -Wno-error -libmadtty_LDFLAGS = +libmadtty_LDFLAGS = -Wl,-soname=libmadtty.so.0 libmadtty_LIBADD = +libmadtty_SONAME = libmad include $(DEPTH)/am/footer.mk -- 2.20.1