2009-10-10 18:07:09 +00:00
|
|
|
#
|
|
|
|
# This file primarily exists for making it possible to test the build
|
|
|
|
# system and external library support from Linux. However, its use is
|
|
|
|
# strongly discouraged; use the (default) libtool rules for building
|
|
|
|
# on Linux.
|
|
|
|
#
|
|
|
|
|
2009-10-10 14:15:09 +00:00
|
|
|
# --- Required interface definitions ---
|
|
|
|
|
|
|
|
OBJ=o
|
|
|
|
LOBJ=o
|
|
|
|
|
|
|
|
# Usage: $(call libname,base)
|
|
|
|
define libname
|
2009-10-10 15:28:33 +00:00
|
|
|
lib$(1).so
|
2009-10-10 14:15:09 +00:00
|
|
|
endef
|
|
|
|
|
|
|
|
# Usage: $(call binname,base)
|
|
|
|
define binname
|
|
|
|
$(1)
|
|
|
|
endef
|
|
|
|
|
|
|
|
# --- Required rule definitions ---
|
|
|
|
|
|
|
|
# 1 2
|
|
|
|
# Usage: $(call compile,src,includes)
|
|
|
|
define compile
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) \
|
|
|
|
$(call depflags,$(basename $(call src_to_obj,$(1)))) \
|
|
|
|
$(foreach I,$(2),-I$(I)) \
|
|
|
|
-c $(1) -o $(call src_to_obj,$(1))
|
|
|
|
endef
|
|
|
|
|
|
|
|
# 1 2
|
|
|
|
# Usage: $(call c_compile,src,includes)
|
|
|
|
define c_compile
|
|
|
|
$(CC) $(CPPFLAGS) $(CFLAGS) \
|
2009-10-10 16:51:20 +00:00
|
|
|
$(call depflags,$(basename $(call c_src_to_obj,$(1)))) \
|
2009-10-10 14:15:09 +00:00
|
|
|
$(foreach I,$(2),-I$(I)) \
|
|
|
|
-c $(1) -o $(call c_src_to_obj,$(1))
|
|
|
|
endef
|
|
|
|
|
|
|
|
define libcompile
|
|
|
|
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -fpic \
|
2009-10-10 17:03:52 +00:00
|
|
|
$(call depflags,$(basename $(call src_to_lobj,$(1)))) \
|
2009-10-10 14:15:09 +00:00
|
|
|
$(foreach I,$(2),-I$(I)) \
|
2009-10-10 17:03:52 +00:00
|
|
|
-c $(1) -o $(call src_to_lobj,$(1))
|
2009-10-10 14:15:09 +00:00
|
|
|
endef
|
2009-10-10 16:51:20 +00:00
|
|
|
define c_libcompile
|
|
|
|
$(CC) $(CPPFLAGS) $(CXXFLAGS) -fpic \
|
|
|
|
$(call depflags,$(basename $(call c_src_to_lobj,$(1)))) \
|
|
|
|
$(foreach I,$(2),-I$(I)) \
|
2009-10-10 17:03:52 +00:00
|
|
|
-c $(1) -o $(call c_src_to_lobj,$(1))
|
2009-10-10 16:51:20 +00:00
|
|
|
endef
|
2009-10-10 14:15:09 +00:00
|
|
|
|
|
|
|
|
2009-10-10 15:28:33 +00:00
|
|
|
# 1 2
|
|
|
|
# Usage: $(call makeslib,objs,library)
|
|
|
|
define makeslib
|
|
|
|
$(RM) $2
|
2009-10-10 15:32:59 +00:00
|
|
|
$(AR) cru $(2) $(1)
|
|
|
|
$(RANLIB) $(2)
|
2009-10-10 15:28:33 +00:00
|
|
|
endef
|
|
|
|
|
2009-10-11 00:24:22 +00:00
|
|
|
# 1 2 3 4 5 6 7
|
|
|
|
# Usage: $(call makelib,objs,library,ldflags,libs,current,revision,age)
|
2009-10-10 14:15:09 +00:00
|
|
|
define makelib
|
2009-10-10 16:51:20 +00:00
|
|
|
$(RM) $(2) $(2).*
|
2009-10-11 00:24:22 +00:00
|
|
|
major=$$(( $(5) - $(7))); \
|
|
|
|
versuffix=$$major.$(7).$(6); \
|
2009-10-10 15:28:33 +00:00
|
|
|
$(CXX) $(CXXFLAGS) -shared -o $(2).$$versuffix $(1) \
|
|
|
|
-Wl,--soname -Wl,`basename $(2)`.$$major \
|
2009-10-11 00:24:22 +00:00
|
|
|
$(3) $(4); \
|
2009-10-10 15:28:33 +00:00
|
|
|
ln -s `basename $(2)`.$$versuffix $(2); \
|
|
|
|
ln -s `basename $(2)`.$$versuffix $(2).$$major
|
2009-10-10 14:15:09 +00:00
|
|
|
endef
|
|
|
|
|
2009-10-11 00:24:22 +00:00
|
|
|
# 1 2 3 4
|
|
|
|
# Usage: $(call makebin,objs,binary,ldflags,libs)
|
2009-10-10 14:15:09 +00:00
|
|
|
define makebin
|
2009-10-11 00:24:22 +00:00
|
|
|
$(CXX) $(CXXFLAGS) $(1) -o $(2) $(LDFLAGS) $(3) $(4)
|
2009-10-10 14:15:09 +00:00
|
|
|
endef
|
2009-10-22 15:20:41 +00:00
|
|
|
|
|
|
|
# Install target
|
|
|
|
|
|
|
|
install: all
|
|
|
|
@echo Automated installation is not supported for buildrules=$(BUILDRULES)
|