aboutsummaryrefslogtreecommitdiffstats
path: root/mk
diff options
context:
space:
mode:
authorkraxel <kraxel>2008-10-14 10:14:15 +0000
committerkraxel <kraxel>2008-10-14 10:14:15 +0000
commit6d6bfa8453392ccc488e6d31586a97600c9d7583 (patch)
tree3eeeca47bcf63973143679244edbe923993d199d /mk
parent6c19f2147bfa61f75775ce2b6c791b9f1d4499ab (diff)
downloadinput-6d6bfa8453392ccc488e6d31586a97600c9d7583.tar.gz
- a bunch of updates for recent input layer changes (new events, ...)
by Guillem Jover - update Makefiles.
Diffstat (limited to 'mk')
-rw-r--r--mk/Autoconf.mk60
-rw-r--r--mk/Compile.mk26
-rw-r--r--mk/Maintainer.mk61
-rw-r--r--mk/Variables.mk52
4 files changed, 132 insertions, 67 deletions
diff --git a/mk/Autoconf.mk b/mk/Autoconf.mk
index 646e47b..7608ea5 100644
--- a/mk/Autoconf.mk
+++ b/mk/Autoconf.mk
@@ -1,7 +1,7 @@
#
# simple autoconf system for GNU make
#
-# (c) 2002,2003 Gerd Knorr <kraxel@bytesex.org>
+# (c) 2002-2006 Gerd Hoffmann <kraxel@suse.de>
#
# credits for creating this one go to the autotools people because
# they managed it to annoy lots of developers and users (including
@@ -24,7 +24,7 @@ ifneq ($(verbose),no)
ac_fini = echo "... result is $${rc}" >&2; echo >&2; echo "$${rc}"
else
# normal
- ac_init = echo -ne "checking $(1) ... " >&2; rc=no
+ ac_init = echo -n "checking $(1) ... " >&2; rc=no
ac_b_cmd = $(1) >/dev/null 2>&1 && rc=yes
ac_s_cmd = rc=`$(1) 2>/dev/null`
ac_fini = echo "$${rc}" >&2; echo "$${rc}"
@@ -47,14 +47,32 @@ ac_uname = $(shell \
$(call ac_s_cmd,uname -s | tr 'A-Z' 'a-z');\
$(call ac_fini))
+ac_uname_arch = $(shell \
+ $(call ac_init,for arch);\
+ $(call ac_s_cmd,uname -m | tr 'A-Z' 'a-z');\
+ $(call ac_fini))
+
# check for some header file
+# args: header file
ac_header = $(shell \
$(call ac_init,for $(1));\
$(call ac_b_cmd,echo '\#include <$(1)>' |\
$(CC) $(CFLAGS) -E -);\
$(call ac_fini))
+# check for some function
+# args: function [, additional libs ]
+ac_func = $(shell \
+ $(call ac_init,for $(1));\
+ echo 'void $(1)(void); int main(void) {$(1)();return 0;}' \
+ > __actest.c;\
+ $(call ac_b_cmd,$(CC) $(CFLAGS) $(LDFLAGS) -o \
+ __actest __actest.c $(2));\
+ rm -f __actest __actest.c;\
+ $(call ac_fini))
+
# check for some library
+# args: function, library [, additional libs ]
ac_lib = $(shell \
$(call ac_init,for $(1) in $(2));\
echo 'void $(1)(void); int main(void) {$(1)();return 0;}' \
@@ -65,15 +83,18 @@ ac_lib = $(shell \
$(call ac_fini))
# check if some compiler flag works
+# args: compiler flag
ac_cflag = $(shell \
- $(call ac_init,if $(CC) supports $(1));\
+ $(call ac_init,for $(CC) cflags);\
echo 'int main() {return 0;}' > __actest.c;\
$(call ac_b_cmd,$(CC) $(CFLAGS) $(1) $(LDFLAGS) -o \
__actest __actest.c);\
rm -f __actest __actest.c;\
+ if test "$${rc}" = "yes"; then rc="$(1)"; else rc="$(2)"; fi;\
$(call ac_fini))
# check for some binary
+# args: binary name
ac_binary = $(shell \
$(call ac_init,for $(1));\
$(call ac_s_cmd,which $(1));\
@@ -82,17 +103,41 @@ ac_binary = $(shell \
$(call ac_fini))
# check if lib64 is used
+#ac_lib64 = $(shell \
+# $(call ac_init,for libdir name);\
+# $(call ac_s_cmd,$(CC) -print-search-dirs | grep -q lib64 &&\
+# echo "lib64" || echo "lib");\
+# $(call ac_fini))
ac_lib64 = $(shell \
$(call ac_init,for libdir name);\
- $(call ac_s_cmd,$(CC) -print-search-dirs | grep -q lib64 &&\
+ $(call ac_s_cmd,/sbin/ldconfig -p | grep -q lib64 &&\
echo "lib64" || echo "lib");\
$(call ac_fini))
# check for x11 ressource dir prefix
ac_resdir = $(shell \
$(call ac_init,for X11 app-defaults prefix);\
- $(call ac_s_cmd, test -d /etc/X11/app-defaults &&\
- echo "/etc/X11" || echo "/usr/X11R6/lib/X11");\
+ $(call ac_s_cmd, for dir in \
+ /etc/X11/app-defaults \
+ /usr/X11R6/lib/X11/app-defaults \
+ /usr/share/X11/app-defaults \
+ /usr/lib/X11/app-defaults \
+ ; do test -d "$$dir" || continue;\
+ dirname "$$dir"; break; done);\
+ $(call ac_fini))
+
+# check if package is installed, via pkg-config
+# args: pkg name
+ac_pkg_config = $(shell \
+ $(call ac_init,for $(1) (using pkg-config));\
+ $(call ac_b_cmd, pkg-config $(1));\
+ $(call ac_fini))
+
+# grep some file
+# args: regex, file
+ac_grep = $(shell \
+ $(call ac_init,for $(1) in $(2));\
+ $(call ac_b_cmd, grep -q $(1) $(2));\
$(call ac_fini))
@@ -116,9 +161,8 @@ endif
config: Make.config
@true
-Make.config: GNUmakefile
+Make.config: $(srcdir)/GNUmakefile
@echo -e "$(make-config-q)" > $@
@echo
@echo "Make.config written, edit if needed"
@echo
-
diff --git a/mk/Compile.mk b/mk/Compile.mk
index 75dadde..ae88f14 100644
--- a/mk/Compile.mk
+++ b/mk/Compile.mk
@@ -1,7 +1,7 @@
#
# some rules to compile stuff ...
#
-# (c) 2002 Gerd Knorr <kraxel@bytesex.org>
+# (c) 2002-2006 Gerd Hoffmann <kraxel@suse.de>
#
# main features:
# * autodependencies via "cpp -MD"
@@ -21,8 +21,10 @@ depfile = mk/$(subst /,_,$*).dep
depfiles = mk/*.dep
compile_c = $(CC) $(CFLAGS) -Wp,-MD,$(tmpdep) -c -o $@ $<
+compile_c_pic = $(CC) $(CFLAGS) -fPIC -Wp,-MD,$(tmpdep) -c -o $@ $<
compile_cc = $(CXX) $(CXXFLAGS) -Wp,-MD,$(tmpdep) -c -o $@ $<
fixup_deps = sed -e "s|.*\.o:|$@:|" < $(tmpdep) > $(depfile) && rm -f $(tmpdep)
+cc_makedirs = mkdir -p $(dir $@) $(dir $(depfile))
link_app = $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
link_so = $(CC) $(LDFLAGS) -shared -Wl,-soname,$(@F) -o $@ $^ $(LDLIBS)
@@ -34,6 +36,7 @@ msgfmt_po = msgfmt -o $@ $<
# non-verbose output
ifeq ($(verbose),no)
echo_compile_c = echo " CC " $@
+ echo_compile_c_pic = echo " CC " $@
echo_compile_cc = echo " CXX " $@
echo_link_app = echo " LD " $@
echo_link_so = echo " LD " $@
@@ -42,6 +45,7 @@ ifeq ($(verbose),no)
echo_msgfmt_po = echo " MSGFMT " $@
else
echo_compile_c = echo $(compile_c)
+ echo_compile_c_pic = echo $(compile_c_pic)
echo_compile_cc = echo $(compile_cc)
echo_link_app = echo $(link_app)
echo_link_so = echo $(link_so)
@@ -51,28 +55,42 @@ else
endif
%.o: %.c
+ @$(cc_makedirs)
@$(echo_compile_c)
@$(compile_c)
@$(fixup_deps)
+%.opic: %.c
+ @$(cc_makedirs)
+ @$(echo_compile_c_pic)
+ @$(compile_c_pic)
+ @$(fixup_deps)
+
%.o: %.cc
+ @$(cc_makedirs)
@$(echo_compile_cc)
@$(compile_cc)
@$(fixup_deps)
%.o: %.cpp
+ @$(cc_makedirs)
@$(echo_compile_cc)
@$(compile_cc)
@$(fixup_deps)
+%: %.o
+ @$(echo_link_app)
+ @$(link_app)
+
%.so: %.o
@$(echo_link_so)
@$(link_so)
-%: %.o
- @$(echo_link_app)
- @$(link_app)
+%.a: %.o
+ @$(echo_ar_lib)
+ @$(ar_lib)
+
%.moc : %.h
@$(echo_moc_h)
diff --git a/mk/Maintainer.mk b/mk/Maintainer.mk
index f5ff691..23446ae 100644
--- a/mk/Maintainer.mk
+++ b/mk/Maintainer.mk
@@ -1,47 +1,28 @@
# just some maintainer stuff for me ...
########################################################################
-make-sync-dir = $(HOME)/src/gnu-make
-pbuilder-dir = /work/pbuilder/result
-snapshot-dir = $(HOME)/snapshot
-snapshot-date = $(shell date +%Y%m%d)
-snapshot-name = $(snapshot-dir)/$(PACKAGE)-$(snapshot-date).tar.gz
+make-sync-dir = $(HOME)/projects/gnu-makefiles
-deb-version = $(shell dpkg-parsechangelog | sed -n 's/^Version: \(.*:\|\)//p')
-deb-arch := $(shell uname -m | sed \
- -e 's/i.86/i386/' \
- -e 's/ppc/powerpc/')
-deb-dsc := ../$(PACKAGE)_$(VERSION).dsc
-deb-changes := $(pbuilder-dir)/$(PACKAGE)_$(VERSION)_$(deb-arch).changes
-
-
-.PHONY: sync checkit release port tarball dist rpm
+.PHONY: sync
sync:: distclean
test -d $(make-sync-dir)
- rm -f INSTALL mk/*.mk
- cp -v $(make-sync-dir)/INSTALL .
- cp -v $(make-sync-dir)/*.mk mk
- chmod 444 INSTALL mk/*.mk
-
-
-dsc source $(deb-dsc): clean
- test "$(VERSION)" = "$(deb-version)"
- dpkg-buildpackage -S -us -uc -rfakeroot
-
-debs pbuild $(deb-changes): $(deb-dsc)
- sudo /usr/sbin/pbuilder build $(deb-dsc)
- -lintian -i $(deb-changes)
-
-release: $(deb-changes)
- debsign $(deb-changes)
-
-
-tarball dist: realclean
- (cd ..; tar czf $(TARBALL) $(DIR))
-
-snapshot snap: realclean
- (cd ..; tar czf $(snapshot-name) $(DIR))
-
-rpm: tarball
- rpm -ta ../$(TARBALL)
+ rm -f $(srcdir)/INSTALL $(srcdir)/mk/*.mk
+ cp -v $(make-sync-dir)/INSTALL $(srcdir)/.
+ cp -v $(make-sync-dir)/*.mk $(srcdir)/mk
+ chmod 444 $(srcdir)/INSTALL $(srcdir)/mk/*.mk
+
+
+repository = $(shell cat CVS/Repository)
+release-dir ?= $(HOME)/projects/Releases
+release-pub ?= goldbach@me.in-berlin.de:dl.bytesex.org/releases/$(repository)
+tarball = $(release-dir)/$(repository)-$(VERSION).tar.gz
+
+.PHONY: release
+release:
+ cvs tag $(RELTAG)
+ cvs export -r $(RELTAG) -d "$(repository)-$(VERSION)" "$(repository)"
+ find "$(repository)-$(VERSION)" -name .cvsignore -exec rm -fv "{}" ";"
+ tar -c -z -f "$(tarball)" "$(repository)-$(VERSION)"
+ rm -rf "$(repository)-$(VERSION)"
+ scp $(tarball) $(release-pub)
diff --git a/mk/Variables.mk b/mk/Variables.mk
index 4449d81..99f787c 100644
--- a/mk/Variables.mk
+++ b/mk/Variables.mk
@@ -1,33 +1,55 @@
# common variables ...
########################################################################
-# package + version
-empty :=
-space := $(empty) $(empty)
-PWD := $(shell pwd)
-DIR := $(patsubst $(dir $(PWD))%,%,$(PWD))
-PACKAGE := $(word 1,$(subst -,$(space),$(DIR)))
-VERSION := $(word 2,$(subst -,$(space),$(DIR)))
-TARBALL := $(PACKAGE)_$(VERSION).tar.gz
-
# directories
DESTDIR =
+srcdir ?= .
prefix ?= /usr/local
bindir = $(DESTDIR)$(prefix)/bin
-mandir = $(DESTDIR)$(prefix)/share/man
-locdir = $(DESTDIR)$(prefix)/share/locale
+sbindir = $(DESTDIR)$(prefix)/sbin
+libdir = $(DESTDIR)$(prefix)/$(LIB)
+shrdir = $(DESTDIR)$(prefix)/share
+mandir = $(shrdir)/man
+locdir = $(shrdir)/locale
+appdir = $(shrdir)/applications
+
+# package + version
+empty :=
+space := $(empty) $(empty)
+ifneq ($(wildcard $(srcdir)/VERSION),)
+ VERSION := $(shell cat $(srcdir)/VERSION)
+else
+ VERSION := 42
+endif
+RELTAG := v$(subst .,_,$(VERSION))
# programs
CC ?= gcc
CXX ?= g++
MOC ?= $(if $(QTDIR),$(QTDIR)/bin/moc,moc)
+
+STRIP ?= -s
INSTALL ?= install
-INSTALL_BINARY := $(INSTALL) -s
+INSTALL_BINARY := $(INSTALL) $(STRIP)
INSTALL_SCRIPT := $(INSTALL)
INSTALL_DATA := $(INSTALL) -m 644
INSTALL_DIR := $(INSTALL) -d
# cflags
-CFLAGS ?= -g -O2
-CFLAGS += -Wall -Wmissing-prototypes -Wstrict-prototypes \
- -Wpointer-arith -Wunused
+CFLAGS ?= -g -O2
+CXXFLAGS ?= $(CFLAGS)
+CFLAGS += -Wall -Wmissing-prototypes -Wstrict-prototypes \
+ -Wpointer-arith -Wunused
+CXXFLAGS += -Wall -Wpointer-arith -Wunused
+
+# add /usr/local to the search path if something is in there ...
+ifneq ($(wildcard /usr/local/include/*.h),)
+ CFLAGS += -I/usr/local/include
+ LDFLAGS += -L/usr/local/$(LIB)
+endif
+
+# fixup include path for $(srcdir) != "."
+ifneq ($(srcdir),.)
+ CFLAGS += -I. -I$(srcdir)
+endif
+