# but by explicly setting the BUILD variable. Make is invoked from
# within the source itself which is much more compatible with compilation
# environments.
+.SILENT:
-ifndef BUILD
-BUILD=$(BASE)/build
+# Search for the build directory
+ifdef BUILD
+BUILD_POSSIBLE = $(BUILD)
+else
+BUILD_POSSIBLE = $(BASE) $(BASE)/build
+endif
+
+BUILD:= $(foreach i,$(BUILD_POSSIBLE),$(wildcard $(i)/environment.mak))
+BUILD:= $(patsubst %/,%,$(firstword $(dir $(BUILD))))
+
+ifeq ($(words $(BUILD)),0)
+error-all:
+ echo Can't find the build directory in $(BUILD_POSSIBLE) -- use BUILD=
endif
# Base definitions
LIB := $(BIN)
OBJ := $(BUILD)/obj
DEP := $(OBJ)
+DOC := $(BUILD)/doc
# Module types
-LIBRARY_H=$(BASE)/buildlib/library.mak
+LIBRARY_H = $(BASE)/buildlib/library.mak
+DEBIANDOC_H = $(BASE)/buildlib/debiandoc.mak
+MANPAGE_H = $(BASE)/buildlib/manpage.mak
+PROGRAM_H = $(BASE)/buildlib/program.mak
# Source location control
# SUBDIRS specifies sub components of the module that
HEADER_TARGETDIRS+=
# Options
-CXX = c++
-CC = cc
+include $(BUILD)/environment.mak
CPPFLAGS+= -I$(INCLUDE)
-CXXFLAGS+= -Wall -g -fno-implicit-templates -fno-exceptions
-PICFLAGS+= -fPIC -DPIC
-LFLAGS+=
-INLINEDEPFLAG = -MD
+LDFLAGS+= -L$(LIB)
# Phony rules. Other things hook these by appending to the dependency
# list
-.PHONY: headers library clean veryclean all binary program
-all: binary
+.PHONY: headers library clean veryclean all binary program doc
+all: binary doc
binary: library program
+maintainer-clean dist-clean: veryclean
headers library clean veryclean program:
# Header file control. We want all published interface headers to go