Makefile.am 5.98 KB
Newer Older
1 2 3 4
include $(top_srcdir)/Makefile.common

# The order of the project files is important for saving compile time

5 6
BUILD_PROJECTS= ocarina-core.gpr ocarina-frontends.gpr			\
	ocarina-backends.gpr ocarina-config.gpr ocarina-transfo.gpr	\
7
	ocarina-main.gpr $(PYTHON_PRJ)
8 9 10

# All project files have to be packaged with "make dist"

11 12 13 14
EXTRA_DIST= $(srcdir)/ocarina.gpr.in $(srcdir)/ocarina-frontends.gpr	\
	$(srcdir)/ocarina-backends.gpr $(srcdir)/ocarina-core.gpr	\
	$(srcdir)/ocarina-main.gpr $(srcdir)/ocarina-transfo.gpr	\
	$(srcdir)/ocarina-config.gpr $(srcdir)/restrictions.adc
15 16 17 18 19 20 21 22 23


BUILD_STAMPS = $(BUILD_PROJECTS:.gpr=.gpr-build)

CLEAN_PROJECTS = $(BUILD_PROJECTS)
CLEAN_STAMPS = $(CLEAN_PROJECTS:.gpr=.gpr-clean)

# Object directories (*.o, *.ali)

24
OBJECT_DIRS = $(top_builddir)/src/core/objects	\
yoogx's avatar
yoogx committed
25
	$(top_builddir)/src/config/objects	\
26 27 28
	$(top_builddir)/src/frontends/objects	\
	$(top_builddir)/src/backends/objects	\
	$(top_builddir)/src/transfo/objects	\
29 30
	$(top_builddir)/src/main/objects	\
	$(top_builddir)/src/python/objects
31 32 33

# Library directories (*.ali, *.a)

34 35 36 37
LIB_DIRS = $(top_builddir)/src/core/libs				\
	$(top_builddir)/src/frontends/libs				\
	$(top_builddir)/src/backends/libs				\
	$(top_builddir)/src/transfo/libs				\
38 39
	$(top_builddir)/src/config/libs $(top_builddir)/src/main/libs	\
	$(top_builddir)/src/python/libs
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55

# All directories used for the build process. If the configure is
# performed from a directory different from the top source directory,
# AND ONLY IN THIS CASE, we need to create some additional
# subdirectories which are used in project files

EXTRA_BUILD_DIRS = /src/core/tree

BUILD_DIRS = ${filter-out \
      ${addprefix $(top_srcdir), $(EXTRA_BUILD_DIRS)}, \
      $(OBJECT_DIRS) $(LIB_DIRS) ${addprefix $(top_builddir), $(EXTRA_BUILD_DIRS)}}

BUILD_DIRS_STAMPS = $(BUILD_DIRS:=-stamp)

# Pseudo-IDL files that are used to generate the tree manipulators.

56 57 58 59 60 61 62 63 64 65
TREE_PIDL_SPECS = src/core/tree/ocarina-me_aadl-aadl_tree-nodes.idl	\
	src/core/tree/ocarina-me_aadl-aadl_instances-nodes.idl		\
	src/core/tree/ocarina-me_aadl_ba-ba_tree-nodes.idl		\
	src/core/tree/ocarina-me_real-real_tree-nodes.idl		\
	src/backends/ocarina-backends-ada_tree-nodes.idl		\
	src/backends/ocarina-backends-c_tree-nodes.idl			\
	src/backends/ocarina-backends-asn1_tree-nodes.idl		\
	src/backends/ocarina-backends-xml_tree-nodes.idl		\
	src/backends/ocarina-backends-pn-nodes.idl			\
	src/backends/ocarina-backends-mast_tree-nodes.idl		\
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
	src/backends/ocarina-backends-rtsj_tree-nodes.idl

TREE_ADA_SPECS = ${addprefix $(top_builddir)/, $(TREE_PIDL_SPECS:.idl=.ads)}
TREE_ADA_BODIES = ${addprefix $(top_builddir)/, $(TREE_PIDL_SPECS:.idl=.adb)}
TREE_PIDL_STAMPS = ${addprefix $(top_builddir)/, $(TREE_PIDL_SPECS:.idl=.idl-stamp)}

# Tree manipulator generation mode:
#  hard : maintainer mode or packaging mode
#  soft : user mode
# This variable has to be set to "hard" by default and overriden by
# calls to make 'GEN_MODE=...'

GEN_MODE = hard

# Various tools

MKNODES_SRC_DIR = $(top_srcdir)/tools/mknodes
MKNODES_BUILD_DIR = $(top_builddir)/tools/mknodes
GENERATE_TREE = $(top_srcdir)/tools/generate_tree.sh

DISTCLEANFILES = \
	$(TREE_ADA_SPECS) \
	$(TREE_ADA_BODIES) \
	$(TREE_PIDL_STAMPS)

PARALLEL_GNATMAKE_FLAGS = -j4

all-local: $(BUILD_DIRS) maybe-generate-tree-files $(BUILD_STAMPS)

$(BUILD_STAMPS): %-build:
	$(INIT_ADA_PROJECT_PATH) $(GNATMAKE_FOR_TARGET) \
	  $(PARALLEL_GNATMAKE_FLAGS) -P $* $(GNATFLAGS) $(GNAT_LIB_FLAGS) \
	  -XABS_SRC_DIR="$(PL_DEP_ABS_SRC_DIR)" \
	  -XABS_BUILD_DIR="$(PL_DEP_ABS_BUILD_DIR)" \
	  $(AP_FLAGS);

clean-local: $(BUILD_DIRS) $(CLEAN_STAMPS) clean-mknodes

104
# XXX creating/deleting ocarina-configuration.adb is to please
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
# gnatclean that requires this file to be present to delete files ...

$(CLEAN_STAMPS): %-clean:
	touch $(top_builddir)/src/main/ocarina-configuration.adb
	$(INIT_ADA_PROJECT_PATH) $(GNATCLEAN) -P $* $(GNATFLAGS) $(GNAT_LIB_FLAGS)\
	  -XABS_SRC_DIR="$(PL_DEP_ABS_SRC_DIR)" \
	  -XABS_BUILD_DIR="$(PL_DEP_ABS_BUILD_DIR)" \
	  $(AP_FLAGS) ;
	rm $(top_builddir)/src/main/ocarina-configuration.adb

distclean-local:
	for d in $(BUILD_DIRS); do \
	  echo "Deleting directory: $${d}"; \
	  rm -rf $${d}; \
	  rm -f $${d}-stamp; \
	done

$(BUILD_DIRS): $(BUILD_DIRS_STAMPS)
	@echo "Creating directory: $@"
	-mkdir -p $@

$(BUILD_DIRS_STAMPS):
	-touch $@

maybe-generate-tree-files: build-mknodes
	$(MAKE) 'GEN_MODE=soft' $(TREE_ADA_SPECS)

# Mknodes needs to be compiled using the native GNATMAKE since it is
# used only on the host.

build-mknodes:
	if [ -f $(MKNODES_SRC_DIR)/mknodes.gpr ]; then \
	   mkdir -p $(MKNODES_BUILD_DIR)/objects; \
	   $(INIT_ADA_PROJECT_PATH) \
	     $(GNATMAKE) -P $(MKNODES_SRC_DIR)/mknodes.gpr \
	     -XABS_SRC_DIR="$(PL_DEP_ABS_SRC_DIR)" \
	     -XABS_BUILD_DIR="$(PL_DEP_ABS_BUILD_DIR)" \
	     $(AP_FLAGS) \
	     $(GNATFLAGS) $(GNAT_LIB_FLAG); \
	fi

clean-mknodes:
	if [ -f $(MKNODES_SRC_DIR)/mknodes.gpr ]; then \
	     $(INIT_ADA_PROJECT_PATH) \
	     $(GNATCLEAN) -P $(MKNODES_SRC_DIR)/mknodes.gpr \
	     -XABS_SRC_DIR="$(PL_DEP_ABS_SRC_DIR)" \
	     -XABS_BUILD_DIR="$(PL_DEP_ABS_BUILD_DIR)" \
	     $(AP_FLAGS); \
	   rm -rf $(MKNODES_BUILD_DIR)/objects; \
	fi

$(top_builddir)/%.ads $(top_builddir)/%.adb: $(top_srcdir)/%.idl $(top_builddir)/%.idl-stamp
	MKNODES_DIR="$(MKNODES_BUILD_DIR)" \
	UHEADERS_DIR="$(top_builddir)/support" \
	OUTPUT_DIR="${dir $@}" \
	GNU_MAKE="${GNU_MAKE}" \
	CYGPATH_W="${CYGPATH_W}" \
	  $(GENERATE_TREE) $(GEN_MODE) $<

%.idl-stamp:
	mkdir -p ${dir $@}
	touch $*.idl-stamp

dist-hook: build-mknodes $(TREE_ADA_SPECS) $(TREE_ADA_BODIES)

debug-makefile:
	@echo "=========================================================="
	@echo "TREE_PIDL_SPECS = $(TREE_PIDL_SPECS)"
	@echo "=========================================================="
	@echo "TREE_PIDL_STAMPS = $(TREE_PIDL_STAMPS)"
	@echo "=========================================================="
	@echo "TREE_ADA_SPECS = $(TREE_ADA_SPECS)"
	@echo "=========================================================="
	@echo "TREE_ADA_BODIES = $(TREE_ADA_BODIES)"
	@echo "=========================================================="