Discussion:
How to add my own rules?
Victor Porton
2017-07-05 16:46:19 UTC
Permalink
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
Victor Porton
2017-07-07 18:25:31 UTC
Permalink
I found:

all-local: ...
...

clean-local: ...
...

...
Post by 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
gnatmake -p -Plibrdf.gpr \
                 -XLIBRARY_KIND=dynamic -XOBJ_DIR=$(builddir)/obj
-Xsoversion=$(soname) -XMODE=Install
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
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)
rm -rf $(ADAINCLUDE)
rm -rf $(ADALIB)
cd $(builddir)/lib && rm -f librdf-ada.so librdf-ada.a
$(soname)
.PHONY: all clean install uninstall
Bob Friesenhahn
2017-07-07 20:48:44 UTC
Permalink
Post by Victor Porton
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
***@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/
Loading...