How to add my own rules?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to add my own rules?

Victor Porton
I have the below Makefile.am

As you see, I don't want to use Automake's Ada language support,
but want to create my own rules for building Ada libraries (because
I want consistent behavior in make and in my IDE which uses gnatmake
and because I don't want to manually specify the list of Ada source
files).

The trouble is that my "all:" rules is not built when I run "make all".
How to add my own rules for building lib/librdf-ada.so and
lib/librdf-ada.a?

#################################

soversion = 2.0.14
soname = librdf-ada.so.$(soversion)

ADAINCLUDE = $(includedir)/librdf
ADALIB = $(libdir)/librdf

LIB_DIR = $(srcdir)/lib

lib/librdf-ada.so:
        gnatmake -p -Plibrdf.gpr \
                 -XLIBRARY_KIND=dynamic -XOBJ_DIR=$(builddir)/obj
-Xsoversion=$(soname) -XMODE=Install

lib/librdf-ada.a:
        gnatmake -p -Plibrdf.gpr \
                 -XLIBRARY_KIND=static -XOBJ_DIR=$(builddir)/obj
-Xsoversion=$(soname) -XMODE=Install

all: $(LIB_DIR)/librdf-ada.so $(LIB_DIR)/librdf-ada.a

clean:
        gnat clean -r -Plibrdf.gpr -XLIBRARY_KIND=dynamic
-XOBJ_DIR=$(builddir)/obj -Xsoversion=$(soname) -XMODE=Install
        gnat clean -r -Plibrdf.gpr -XLIBRARY_KIND=static
-XOBJ_DIR=$(builddir)/obj -Xsoversion=$(soname) -XMODE=Install
        gnat clean -r -Ptest.gpr -XLIBRARY_KIND=dynamic
-XOBJ_DIR=$(builddir)/obj/test -Xsoversion=$(soname) -XMODE=Install
        gnat clean -r -Ptest.gpr -XLIBRARY_KIND=static
-XOBJ_DIR=$(builddir)/obj/test -Xsoversion=$(soname) -XMODE=Install
        rm -f $(builddir)/lib/$(soname)

install: all
        mkdir -p $(ADAINCLUDE)
        mkdir -p $(ADALIB)
        mkdir -p $(libdir)
        cd $(srcdir)/src && $(INSTALL_DATA) *.ads *.adb $(ADAINCLUDE)
        cd $(builddir)/ali && $(INSTALL_DATA) *.ali $(ADALIB)
        $(INSTALL_DATA) lib/librdf-ada.so lib/librdf-ada.a $(soname)
$(libdir)


uninstall:
        rm -rf $(ADAINCLUDE)
        rm -rf $(ADALIB)
        cd $(builddir)/lib && rm -f librdf-ada.so librdf-ada.a
$(soname)

.PHONY: all clean install uninstall

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to add my own rules?

Victor Porton
I found:

all-local: ...
        ...

clean-local: ...
        ...

...

On Wed, 2017-07-05 at 19:46 +0300, Victor Porton wrote:

> I have the below Makefile.am
>
> As you see, I don't want to use Automake's Ada language support,
> but want to create my own rules for building Ada libraries (because
> I want consistent behavior in make and in my IDE which uses gnatmake
> and because I don't want to manually specify the list of Ada source
> files).
>
> The trouble is that my "all:" rules is not built when I run "make all".
> How to add my own rules for building lib/librdf-ada.so and
> lib/librdf-ada.a?
>
> #################################
>
> soversion = 2.0.14
> soname = librdf-ada.so.$(soversion)
>
> ADAINCLUDE = $(includedir)/librdf
> ADALIB = $(libdir)/librdf
>
> LIB_DIR = $(srcdir)/lib
>
> lib/librdf-ada.so:
> gnatmake -p -Plibrdf.gpr \
>                  -XLIBRARY_KIND=dynamic -XOBJ_DIR=$(builddir)/obj
> -Xsoversion=$(soname) -XMODE=Install
>
> lib/librdf-ada.a:
> gnatmake -p -Plibrdf.gpr \
>  -XLIBRARY_KIND=static -XOBJ_DIR=$(builddir)/obj
> -Xsoversion=$(soname) -XMODE=Install
>
> all: $(LIB_DIR)/librdf-ada.so $(LIB_DIR)/librdf-ada.a
>
> clean:
> gnat clean -r -Plibrdf.gpr -XLIBRARY_KIND=dynamic
> -XOBJ_DIR=$(builddir)/obj -Xsoversion=$(soname) -XMODE=Install
> gnat clean -r -Plibrdf.gpr -XLIBRARY_KIND=static
> -XOBJ_DIR=$(builddir)/obj -Xsoversion=$(soname) -XMODE=Install
> gnat clean -r -Ptest.gpr -XLIBRARY_KIND=dynamic
> -XOBJ_DIR=$(builddir)/obj/test -Xsoversion=$(soname) -XMODE=Install
> gnat clean -r -Ptest.gpr -XLIBRARY_KIND=static
> -XOBJ_DIR=$(builddir)/obj/test -Xsoversion=$(soname) -XMODE=Install
> rm -f $(builddir)/lib/$(soname)
>
> install: all
> mkdir -p $(ADAINCLUDE)
> mkdir -p $(ADALIB)
> mkdir -p $(libdir)
> cd $(srcdir)/src && $(INSTALL_DATA) *.ads *.adb $(ADAINCLUDE)
> cd $(builddir)/ali && $(INSTALL_DATA) *.ali $(ADALIB)
> $(INSTALL_DATA) lib/librdf-ada.so lib/librdf-ada.a $(soname)
> $(libdir)
>
>
> uninstall:
> rm -rf $(ADAINCLUDE)
> rm -rf $(ADALIB)
> cd $(builddir)/lib && rm -f librdf-ada.so librdf-ada.a
> $(soname)
>
> .PHONY: all clean install uninstall
>


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to add my own rules?

Bob Friesenhahn
On Fri, 7 Jul 2017, Victor Porton wrote:

> I found:
>
> all-local: ...
> ...
>
> clean-local: ...
> ...

You can also override any rule generated by Automake with your own
rule with the same target name.

Bob
--
Bob Friesenhahn
[hidden email], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

Loading...