help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to generalize a lib make rules.


From: Palani Chinnakannan (pals)
Subject: How to generalize a lib make rules.
Date: Sun, 20 Jun 2010 12:08:15 -0700

Hello,

    I need to write a set of rules etc to make a library that can be used project

wide.  First let me give a specific instance of  how I make library; then I need

some help on showing me how to generalize this

 

 

The following lines are specified to build a library.  I want my team members to

specify this in their makefiles, one set for each makefile.

 

A_MAJ     := 0

A_MIN     := 0

A_REV     := 1

A_LIB     := libclos_trace.so

A_LIB_SRCS:=\

                clos_trace.c

 

 

Now, for each library I want the following lines to be some how (???))  auto generated/inserted/

function called/macroe … whatever that will make it hide from the user

 

 

A_LIB_OBJS:= $(A_LIB_SRCS:%.c=$(ARCH)/%.o)

 

$(A_LIB): $(ARCH)/$(A_LIB).$(A_MAJ).$(A_MIN).$(A_REV)

$(ARCH)/$(A_LIB).$(A_MAJ).$(A_MIN).$(A_REV): $(A_LIB_OBJS)

                mkdir -p $(ARCH); ld -shared -soname $(A_LIB).$(A_MAJ) -o $@ $?

 

 

Now, if we can hide the following it will be nice, however, we are OK to add this

 

make_libs: $(A_LIB) $(B_LIB) $(C_LIB)

 

 

So, I tried

 

define clos_mk_lib

clos_lib:= $(1)

                clos_src:= $(2)

                clos_maj = $(3)

                clos_min = $(4)

                clos_rev = $(5)

 

 

 

                _OBJS:= $(clos_src:%.c=$(ARCH)/%.o)

 

$(clos_lib): $(ARCH)/$(clos_lib).$(clos_maj).$(clos_min).$(clos_rev)

 

$(ARCH)/$(clos_lib).$(clos_maj).$(clos_min).$(clos_rev): $(_OBJS)

                @echo $(clos_lib) $(clos_src);

                mkdir -p $(ARCH); ld -shared -soname $(clos_lib).$(clos_major) -o $@ $?

 

endef

 

make_libs:

                $(call clos_mk_lib,libclos_trace.so,$(LIB_CLOS_TRACE_SRCS),$(MAJOR),$(MINOR),$(REV))

 

 

 

 

 

 

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]