Makefile.common 2.55 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
# The use of ADA_PROJECT_PATH="..." is incompatible with the use of
# the -aP gnatmake flag.

if HAS_GNATMAKE_APDIR
INIT_ADA_PROJECT_PATH =
if HAS_XMLADA
AP_FLAGS = ${addprefix -aP, $(XMLADA_PRJ) $(top_srcdir)/projects $(top_builddir)/projects}
else
AP_FLAGS = ${addprefix -aP, $(top_srcdir)/projects $(top_builddir)/projects}
endif
else
if HAS_XMLADA
INIT_ADA_PROJECT_PATH = ADA_PROJECT_PATH="$(XMLADA_PRJ)$(PATH_SEP)$(top_srcdir)/projects$(PATH_SEP)$(top_builddir)/projects$(PATH_SEP)$$ADA_PROJECT_PATH"
else
INIT_ADA_PROJECT_PATH = ADA_PROJECT_PATH="$(top_srcdir)/projects$(PATH_SEP)$(top_builddir)/projects$(PATH_SEP)$$ADA_PROJECT_PATH"
endif
AP_FLAGS =
endif

# The absolute source and build dire, depending on the platform

PL_DEP_ABS_SRC_DIR = ${shell $(CYGPATH_W) "@abs_top_srcdir@/src"}
PL_DEP_ABS_BUILD_DIR = ${shell $(CYGPATH_W) "@abs_top_builddir@/src"}

# The absolute path to the XMLAda project directory, depending on the
# platform

XMLADA_PRJ = ${shell $(CYGPATH_W) "@XMLADA_PROJECT@"}

# Some common rules to fetch Ada specs and bodies

# If the Ada specs and bodies have to be generated from Pseudo-IDL
# descriptions, we deduce their name from the P-IDL file name and we
# remove the source directory prefix because they would be located in
# the build directory.

PIDL_SPECS=${shell find $(srcdir) -name '*.idl' 2> /dev/null}
TREE_SPECS=${patsubst $(srcdir)/%, %, $(PIDL_SPECS:.idl=.ads)}
TREE_BODIES=${patsubst $(srcdir)/%, %, $(PIDL_SPECS:.idl=.adb)}

# Retrieve all other Ada specs and bodies.

BRUTE_ADA_SPECS=${shell find . $(srcdir) -name '*.ads' | grep -v 'b~' 2> /dev/null}
BRUTE_ADA_BODIES=${shell find . $(srcdir) -name '*.adb' | grep -v 'b~' 2> /dev/null}

# The purpose of the sort is to remove duplicates.

ADA_SPECS = ${sort $(TREE_SPECS) $(BRUTE_ADA_SPECS)}
ADA_BODIES = ${sort $(TREE_BODIES) $(BRUTE_ADA_BODIES)}

# Common rule to install Ada sources and libraries (Requires $(alidir)
# to be defined in the including make file)

adadir = $(includedir)/ocarina
alidir = $(libdir)/ocarina

install-ada-libs:
	$(INSTALL) -d $(DESTDIR)$(adadir)
	$(INSTALL) -d $(DESTDIR)$(alidir)
	for f in $(ADA_SPECS) $(ADA_BODIES); do \
	  $(INSTALL) -m 444 $$f $(DESTDIR)$(adadir); \
	done
63
	if [ "$(shell ls -A libs)" ]; then \
64 65
	for f in libs/*.ali; do \
	  $(INSTALL) -m 444 $$f $(DESTDIR)$(alidir); \
66 67
	done \
	fi
68
	$(INSTALL) -d $(DESTDIR)$(libdir)
69
	if [ "$(shell ls -A libs/lib*)" ]; then \
70 71
	for f in libs/lib*; do \
	  $(INSTALL) -m 444 $$f $(DESTDIR)$(libdir); \
72 73
	done \
	fi
74 75 76 77

uninstall-ada-libs:
	rm -rf $(DESTDIR)$(adadir) $(DESTDIR)$(alidir)
	rm -f $(DESTDIR)$(libdir)/libocarina*