aboutsummaryrefslogtreecommitdiffstats
path: root/mk
diff options
context:
space:
mode:
Diffstat (limited to 'mk')
-rw-r--r--mk/Autoconf.mk19
-rw-r--r--mk/Compile.mk20
-rw-r--r--mk/Maintainer.mk16
-rw-r--r--mk/Variables.mk13
4 files changed, 61 insertions, 7 deletions
diff --git a/mk/Autoconf.mk b/mk/Autoconf.mk
index 65cd915..27eeb32 100644
--- a/mk/Autoconf.mk
+++ b/mk/Autoconf.mk
@@ -47,6 +47,11 @@ 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 \
@@ -97,9 +102,14 @@ 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))
@@ -122,6 +132,13 @@ ac_pkg_config = $(shell \
$(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))
+
########################################################################
# build Make.config
diff --git a/mk/Compile.mk b/mk/Compile.mk
index da14d58..4ab59f4 100644
--- a/mk/Compile.mk
+++ b/mk/Compile.mk
@@ -21,6 +21,7 @@ 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))
@@ -35,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 " $@
@@ -43,6 +45,7 @@ ifeq ($(verbose),no)
echo_msgfmt_po = echo " MSGFMT " $@
else
echo_compile_c = echo $(compile_c)
+ echo_compile_c = echo $(compile_c_pic)
echo_compile_cc = echo $(compile_cc)
echo_link_app = echo $(link_app)
echo_link_so = echo $(link_so)
@@ -57,6 +60,12 @@ endif
@$(compile_c)
@$(fixup_deps)
+%.opic: %.c
+ @$(cc_makedirs)
+ @$(echo_compile_c_pic)
+ @$(compile_c_pic)
+ @$(fixup_deps)
+
%.o: %.cc
@$(cc_makedirs)
@$(echo_compile_cc)
@@ -70,13 +79,18 @@ endif
@$(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 62f02d6..23446ae 100644
--- a/mk/Maintainer.mk
+++ b/mk/Maintainer.mk
@@ -10,3 +10,19 @@ sync:: distclean
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 69486f3..99f787c 100644
--- a/mk/Variables.mk
+++ b/mk/Variables.mk
@@ -6,8 +6,12 @@ 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 :=
@@ -17,13 +21,16 @@ ifneq ($(wildcard $(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