#
-# Copyright (C) 1999 Silicon Graphics, Inc. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of version 2 of the GNU General Public License as published
-# by the Free Software Fondation.
-#
-# This program is distributed in the hope that it would be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE. Further, any license provided herein,
-# whether implied or otherwise, is limited to this program in accordance with
-# the express provisions of the GNU General Public License. Patent licenses,
-# if any, provided herein do not apply to combinations of this program with
-# other product or programs, or any other product whatsoever. This program is
-# distributed without any warranty that the program is delivered free of the
-# rightful claim of any third person by way of infringement or the like. See
-# the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write the Free Software Foundation, Inc., 59 Temple
-# Place - Suite 330, Boston MA 02111-1307, USA.
-# Common build rules for gmake
+# Copyright (c) 1999, 2001-2003 Silicon Graphics, Inc. All Rights Reserved.
#
ifndef _BUILDRULES_INCLUDED_
_BUILDRULES_INCLUDED_ = 1
include $(TOPDIR)/include/builddefs
-clean clobber : $(SUBDIRS)
- rm -f $(DIRT)
- @rm -fr .libs
- $(SUBDIRS_MAKERULE)
+clean clobber : $(addsuffix -clean,$(SUBDIRS))
+ @rm -f $(DIRT) .ltdep .dep
+ @rm -fr $(DIRDIRT)
+%-clean:
+ @echo "Cleaning $*"
+ $(Q)$(MAKE) $(MAKEOPTS) -C $* clean
+
+ifdef HDR_SUBDIRS
+.PHONY: .xfs
+
+headers: $(addsuffix -headers, $(HDR_SUBDIRS))
+
+%-headers: .xfs
+ @echo " [HEADERS] $*"
+ $(Q)$(MAKE) $(MAKEOPTS) -C $* NODEP=1 install-headers
+
+.xfs:
+ @mkdir -p include/xfs
+endif
# Never blow away subdirs
ifdef SUBDIRS
.PRECIOUS: $(SUBDIRS)
+.PHONY: $(SUBDIRS)
+
$(SUBDIRS):
- $(SUBDIRS_MAKERULE)
+ @echo "Building $@"
+ $(Q)$(MAKE) $(MAKEOPTS) -q -C $@ || $(MAKE) $(MAKEOPTS) -C $@
endif
#
ifdef LTCOMMAND
$(LTCOMMAND) : $(SUBDIRS) $(OBJECTS) $(LTDEPENDENCIES)
- $(LTLINK) -o $@ $(LDFLAGS) $(OBJECTS) $(LDLIBS)
+ @echo " [LD] $@"
+ $(Q)$(LTLINK) -o $@ $(LDFLAGS) $(OBJECTS) $(LDLIBS)
endif
ifdef LTLIBRARY
$(LTLIBRARY) : $(SUBDIRS) $(LTOBJECTS)
- $(LTLINK) $(LTLDFLAGS) -o $(LTLIBRARY) $(LTOBJECTS) $(LTLIBS)
+ @echo " [LD] $@"
+ $(Q)$(LTLINK) $(LTLDFLAGS) -o $(LTLIBRARY) $(LTOBJECTS) $(LTLIBS)
%.lo: %.c
- $(LTCOMPILE) -c $<
+ @echo " [CC] $@"
+ $(Q)$(LTCOMPILE) -c $<
+else
+%.o: %.c
+ @echo " [CC] $@"
+ $(Q)$(CC) $(CFLAGS) -c $<
+
endif
-source :
- $(SOURCE_MAKERULE)
+ifdef POTHEAD
+$(POTHEAD): $(XGETTEXTFILES)
+ @echo " [GETTXT] $@"
+ $(Q)$(XGETTEXT) --language=C --keyword=_ --keyword=N_ -o $@ $(XGETTEXTFILES)
+
+# Update translations
+update-po: $(POTHEAD) $(wildcard $(TOPDIR)/po/*.po)
+ catalogs="$(wildcard $(TOPDIR)/po/*.po)"; \
+ for cat in $$catalogs; do \
+ lang=`basename $$cat .po`; \
+ mv $$lang.po $$lang.old.po; \
+ echo "$$lang:"; \
+ if $(MSGMERGE) $$lang.old.po $(POTHEAD) -o $$lang.po; then \
+ rm -f $$lang.old.po; \
+ else \
+ echo "msgmerge for $$lang failed!"; \
+ rm -f $$lang.po; \
+ mv $$lang.old.po $$lang.po; \
+ fi; \
+ done
+
+%.mo: %.po
+ @echo " [MSGFMT] $@"
+ $(Q)$(MSGFMT) -c --statistics -o $@ $<
+endif
endif # _BUILDRULES_INCLUDED_
$(_FORCE):
-.PHONY : depend
-
-depend : $(CFILES) $(HFILES)
- $(SUBDIRS_MAKERULE)
- touch .dep
- $(MAKEDEPEND) -f - -- $(CFLAGS) -- $(CFILES) | \
- $(SED) -e 's,`pwd`,$(TOPDIR),g' \
- -e 's, */[^ ]*,,g' \
- -e '/^[^ ]*: *$$/d' \
- -e '/^#.*/d' -e '/^ *$$/d' \
- > .dep
- test -s .dep || rm -f .dep
-
-# Include dep, but only if it exists
-ifeq ($(shell test -f .dep && echo .dep), .dep)
-include .dep
-endif
+# dependency build is automatic, relies on gcc -MM to generate.
+#
+# This is a bit messy. It regenerates the dependencies on each build so
+# that we catch files being added and removed. There are other ways of doing
+# this (e.g. per-file dependency files) but that requires more in-depth changes
+# to the build system. Compile time is not an issue for us, so the
+# rebuild on every make invocation isn't a problem we need to care about. Just
+# do it silently so it doesn't make the build unnecessarily noisy.
+
+.PHONY : depend ltdepend
+
+MAKEDEP := $(MAKEDEPEND) $(CFLAGS)
+
+ltdepend: rmltdep .ltdep
+
+rmltdep:
+ $(Q)rm -f .ltdep
+
+.ltdep: $(CFILES) $(HFILES)
+ $(Q)$(MAKEDEP) $(CFILES) | $(SED) -e 's,^\([^:]*\)\.o,\1.lo,' > .ltdep
+
+depend: rmdep .dep
+
+rmdep:
+ $(Q)rm -f .dep
+
+.dep: $(CFILES) $(HFILES)
+ $(Q)$(MAKEDEP) $(CFILES) > .dep