Files
OpenUxAS/Makefile

156 lines
4.6 KiB
Makefile
Raw Permalink Normal View History

2020-03-20 11:34:42 +01:00
# Platform
Bootstrap Integration (#24) * Integrate OpenUxAS-bootstrap into OpenUxAS This commit represents a complete, working integration along with several key enhancements. Note that the README is entirely unchanged and not suitable. ***NOTE: the build will fail currently because of a problem with e3*** e3 provides no way to modify the list of excluded globs for sync_tree; this will need to be fixed. The bootstrap script works and will download and install needed support for anod. The instructions printed at the end of the install are out of date; the user doesn't need to do anything more than call anod with ./anod build uxas The top-level anod script takes care of activating the python venv and then calls the python anod script. The user can also `source anod`, which will then register anod as a shell function, allowing simpler invocation and a working setenv command. Anod's devel setup no longer supports uxas, since that's superfluous. It does support lmcpgen and amase. They are placed in `develop` as before, although finding a better name for the containing directory seems nice. run-example works, as does resources/RunLmcpGen make works VS Code integration works There is definite room for improvement. Specifically, factoring the informtion about repository structure into some central set of includable scripts seems like it should be really useful. Likewise, anod's support should be a real python module so that it's easier to use. Finally, there's no reason not to automatically install the python venv and all needed support the first time anod is invokved (including from make). This would eliminate a needed step by the user. We could still retain the bootstrap script if desired. * Rename and create constants for repo structure This commit reorganizes the directories a bit and introduces better handling of pathnames through constants defined in paths.sh. Unfortunately, because of the way python handles environment variables, (and because we can't necessarily assume that python scripts are always invoked through shell scripts that call paths.sh) we have to duplicate a lot of the path information; this will hopefully be addressed in a future commit. * Refactor infrastructure and add github workflows. OpenUxAS anod support is now a proper python module named `uxas`. Paths within the uxas module are refactored. The module directory under infrastructure/uxas has the expected layout for a python module project and includes a tox.ini file so that tox can be used for development and in CI. infrastructure/install is now a script that calls into python scripts in infrastructure/install-libexec; these are not a proper python module, since that would create a chicken-and-egg problem. There is a tox.ini file here, too, for development and CI. infrastructure/bootstrap is the new bootstrap script, which is less useful now but still usable. Scripts have been updated as needed to take advantage of the uxas python module. In particular, anod and run-example check for the python venv and call into infrastructure/install if needed. * Add Ada support and improve scripts Added support for Ada back in by reactivating and updating install-gnat.py Added Ada build-prove workflow Refactored venv activation to paths.sh Added ensure_gnat, which will check for gnat on the path (via which) or will add a local install of GNAT CE to the path (if it's there) or will offer to install GNAT CE via install-gnat.py This means the user can always choose a different GNAT and it will be used; otherwise, the local install of GNAT CE will be used. Added wrapper shell scripts for the python testing and proof scripts so that the environment can be automatically configured. Updated the C++ workflow Note: sourcing anod and then running anod as a shell function isn't behaving quite right in either bash or zsh (and for different reasons). Needs further investigation. * Add debug output to print commands executed. This should address concern that users won't be able to figure out what the scripts are doing if things break and require manual intervention. Also modify the workflows so that they will run if critical scripts are updated. * Enhance run-example to better search for binaries. run-example now follows similar logic to run-tests in searching for binaries. uxas and uxas-ada are also special-cased so that searching locally and in anod should succeed as expected. The search order is: 1. path (using `which`) 2. local (obj/cpp/uxas or src/ada/uxas-ada) 3. anod (inside uxas-release or uxas-ada-release) run-example also follows similar logic in search for OpenAMASE: 1. specified via argument 2. local (develop/OpenAMASE) 3. anod (inside amse) I believe these have all been tested. Help / error strings have been updated so that they are consistent with the new infrastructure. Debug output has been improved to be more consistent with that provided by e3 (but doesn't actually directly use e3, still). This commit also improves the .gitignore for ada support and updates the Makefile so that it removes the binary on clean. * Update README and scripts. Create a temporary README with testing instructions. Also fix some issues in the debug output of the scripts (the $ was not escaped properly in some instances). * Relativize path to anod in run-example This looks nicer and better supports the common case: in which the user runs run-example from the repo root. * Fix python version in Makefile Makefile was using python to determine the platform; this was one of a few remaining non-python3 uses of `python`. Having fixed it, things seem to work smoothly on a machine where python ≠ python3. * Don't install GNAT CE by default. Most users won't want to build Ada, so offering to install GNAT CE by default is likely to just be confusing. * Change the way Java is installed. Rather than installing Java (OpenJDK 13) by way of anod in the sandbox, instead install Java (OpenJDK 11) by way of apt. This results in Java being available system-wide and avoids having to put ant/java on the path using anod commands for things like generating LMCP. Update workflows to install Java using the appropriate github action. This should reduce the number of spurious build failures we've encountered. * Fix run-example issue for uxas-ada. The shared library for uxas-ada wasn't being placed on the path. Additionally, there was an unconditional and unlogged exit leftover from testing in the python script. * Update anod self-install process to be automatic. Rather than running the install script in interactive mode, give the user a full message up front that explains what will happen, followed by a choice to continue. Then, run the install script in automatic mode. This avoids some confusion identified whereby the script seems to ask multiple times to do things in a way that's not particularly helpful when the expectation is that it will just "take care of things" for the user. * Update the README This new version of the README is tailored to the changes that were made to integrated -bootstrap into this repository. It is intended to be minimal and simple. Detail will be provided later to the documentation site that AFRL is setting up. Once that site is live, links will be made from this README to that site. * Improve script with debug_and_run Rather than printing the string for a command and then separately issuing the command, we pass the string form of the command to a debug print method and then eval the string. This removes duplication and ensures that the printed command really is the command that is executed. * Minor improvements to README Fix a couple of typos.
2021-04-01 15:30:51 -04:00
PLATFORM:=$(shell python3 -c "import sys; print(sys.platform)")
2020-03-20 11:34:42 +01:00
Bootstrap Integration (#24) * Integrate OpenUxAS-bootstrap into OpenUxAS This commit represents a complete, working integration along with several key enhancements. Note that the README is entirely unchanged and not suitable. ***NOTE: the build will fail currently because of a problem with e3*** e3 provides no way to modify the list of excluded globs for sync_tree; this will need to be fixed. The bootstrap script works and will download and install needed support for anod. The instructions printed at the end of the install are out of date; the user doesn't need to do anything more than call anod with ./anod build uxas The top-level anod script takes care of activating the python venv and then calls the python anod script. The user can also `source anod`, which will then register anod as a shell function, allowing simpler invocation and a working setenv command. Anod's devel setup no longer supports uxas, since that's superfluous. It does support lmcpgen and amase. They are placed in `develop` as before, although finding a better name for the containing directory seems nice. run-example works, as does resources/RunLmcpGen make works VS Code integration works There is definite room for improvement. Specifically, factoring the informtion about repository structure into some central set of includable scripts seems like it should be really useful. Likewise, anod's support should be a real python module so that it's easier to use. Finally, there's no reason not to automatically install the python venv and all needed support the first time anod is invokved (including from make). This would eliminate a needed step by the user. We could still retain the bootstrap script if desired. * Rename and create constants for repo structure This commit reorganizes the directories a bit and introduces better handling of pathnames through constants defined in paths.sh. Unfortunately, because of the way python handles environment variables, (and because we can't necessarily assume that python scripts are always invoked through shell scripts that call paths.sh) we have to duplicate a lot of the path information; this will hopefully be addressed in a future commit. * Refactor infrastructure and add github workflows. OpenUxAS anod support is now a proper python module named `uxas`. Paths within the uxas module are refactored. The module directory under infrastructure/uxas has the expected layout for a python module project and includes a tox.ini file so that tox can be used for development and in CI. infrastructure/install is now a script that calls into python scripts in infrastructure/install-libexec; these are not a proper python module, since that would create a chicken-and-egg problem. There is a tox.ini file here, too, for development and CI. infrastructure/bootstrap is the new bootstrap script, which is less useful now but still usable. Scripts have been updated as needed to take advantage of the uxas python module. In particular, anod and run-example check for the python venv and call into infrastructure/install if needed. * Add Ada support and improve scripts Added support for Ada back in by reactivating and updating install-gnat.py Added Ada build-prove workflow Refactored venv activation to paths.sh Added ensure_gnat, which will check for gnat on the path (via which) or will add a local install of GNAT CE to the path (if it's there) or will offer to install GNAT CE via install-gnat.py This means the user can always choose a different GNAT and it will be used; otherwise, the local install of GNAT CE will be used. Added wrapper shell scripts for the python testing and proof scripts so that the environment can be automatically configured. Updated the C++ workflow Note: sourcing anod and then running anod as a shell function isn't behaving quite right in either bash or zsh (and for different reasons). Needs further investigation. * Add debug output to print commands executed. This should address concern that users won't be able to figure out what the scripts are doing if things break and require manual intervention. Also modify the workflows so that they will run if critical scripts are updated. * Enhance run-example to better search for binaries. run-example now follows similar logic to run-tests in searching for binaries. uxas and uxas-ada are also special-cased so that searching locally and in anod should succeed as expected. The search order is: 1. path (using `which`) 2. local (obj/cpp/uxas or src/ada/uxas-ada) 3. anod (inside uxas-release or uxas-ada-release) run-example also follows similar logic in search for OpenAMASE: 1. specified via argument 2. local (develop/OpenAMASE) 3. anod (inside amse) I believe these have all been tested. Help / error strings have been updated so that they are consistent with the new infrastructure. Debug output has been improved to be more consistent with that provided by e3 (but doesn't actually directly use e3, still). This commit also improves the .gitignore for ada support and updates the Makefile so that it removes the binary on clean. * Update README and scripts. Create a temporary README with testing instructions. Also fix some issues in the debug output of the scripts (the $ was not escaped properly in some instances). * Relativize path to anod in run-example This looks nicer and better supports the common case: in which the user runs run-example from the repo root. * Fix python version in Makefile Makefile was using python to determine the platform; this was one of a few remaining non-python3 uses of `python`. Having fixed it, things seem to work smoothly on a machine where python ≠ python3. * Don't install GNAT CE by default. Most users won't want to build Ada, so offering to install GNAT CE by default is likely to just be confusing. * Change the way Java is installed. Rather than installing Java (OpenJDK 13) by way of anod in the sandbox, instead install Java (OpenJDK 11) by way of apt. This results in Java being available system-wide and avoids having to put ant/java on the path using anod commands for things like generating LMCP. Update workflows to install Java using the appropriate github action. This should reduce the number of spurious build failures we've encountered. * Fix run-example issue for uxas-ada. The shared library for uxas-ada wasn't being placed on the path. Additionally, there was an unconditional and unlogged exit leftover from testing in the python script. * Update anod self-install process to be automatic. Rather than running the install script in interactive mode, give the user a full message up front that explains what will happen, followed by a choice to continue. Then, run the install script in automatic mode. This avoids some confusion identified whereby the script seems to ask multiple times to do things in a way that's not particularly helpful when the expectation is that it will just "take care of things" for the user. * Update the README This new version of the README is tailored to the changes that were made to integrated -bootstrap into this repository. It is intended to be minimal and simple. Detail will be provided later to the documentation site that AFRL is setting up. Once that site is live, links will be made from this README to that site. * Improve script with debug_and_run Rather than printing the string for a command and then separately issuing the command, we pass the string form of the command to a debug print method and then eval the string. This removes duplication and ensures that the printed command really is the command that is executed. * Minor improvements to README Fix a couple of typos.
2021-04-01 15:30:51 -04:00
# Path to the makefile and containing directory
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
current_dir := $(dir $(mkfile_path))
Bootstrap Integration (#24) * Integrate OpenUxAS-bootstrap into OpenUxAS This commit represents a complete, working integration along with several key enhancements. Note that the README is entirely unchanged and not suitable. ***NOTE: the build will fail currently because of a problem with e3*** e3 provides no way to modify the list of excluded globs for sync_tree; this will need to be fixed. The bootstrap script works and will download and install needed support for anod. The instructions printed at the end of the install are out of date; the user doesn't need to do anything more than call anod with ./anod build uxas The top-level anod script takes care of activating the python venv and then calls the python anod script. The user can also `source anod`, which will then register anod as a shell function, allowing simpler invocation and a working setenv command. Anod's devel setup no longer supports uxas, since that's superfluous. It does support lmcpgen and amase. They are placed in `develop` as before, although finding a better name for the containing directory seems nice. run-example works, as does resources/RunLmcpGen make works VS Code integration works There is definite room for improvement. Specifically, factoring the informtion about repository structure into some central set of includable scripts seems like it should be really useful. Likewise, anod's support should be a real python module so that it's easier to use. Finally, there's no reason not to automatically install the python venv and all needed support the first time anod is invokved (including from make). This would eliminate a needed step by the user. We could still retain the bootstrap script if desired. * Rename and create constants for repo structure This commit reorganizes the directories a bit and introduces better handling of pathnames through constants defined in paths.sh. Unfortunately, because of the way python handles environment variables, (and because we can't necessarily assume that python scripts are always invoked through shell scripts that call paths.sh) we have to duplicate a lot of the path information; this will hopefully be addressed in a future commit. * Refactor infrastructure and add github workflows. OpenUxAS anod support is now a proper python module named `uxas`. Paths within the uxas module are refactored. The module directory under infrastructure/uxas has the expected layout for a python module project and includes a tox.ini file so that tox can be used for development and in CI. infrastructure/install is now a script that calls into python scripts in infrastructure/install-libexec; these are not a proper python module, since that would create a chicken-and-egg problem. There is a tox.ini file here, too, for development and CI. infrastructure/bootstrap is the new bootstrap script, which is less useful now but still usable. Scripts have been updated as needed to take advantage of the uxas python module. In particular, anod and run-example check for the python venv and call into infrastructure/install if needed. * Add Ada support and improve scripts Added support for Ada back in by reactivating and updating install-gnat.py Added Ada build-prove workflow Refactored venv activation to paths.sh Added ensure_gnat, which will check for gnat on the path (via which) or will add a local install of GNAT CE to the path (if it's there) or will offer to install GNAT CE via install-gnat.py This means the user can always choose a different GNAT and it will be used; otherwise, the local install of GNAT CE will be used. Added wrapper shell scripts for the python testing and proof scripts so that the environment can be automatically configured. Updated the C++ workflow Note: sourcing anod and then running anod as a shell function isn't behaving quite right in either bash or zsh (and for different reasons). Needs further investigation. * Add debug output to print commands executed. This should address concern that users won't be able to figure out what the scripts are doing if things break and require manual intervention. Also modify the workflows so that they will run if critical scripts are updated. * Enhance run-example to better search for binaries. run-example now follows similar logic to run-tests in searching for binaries. uxas and uxas-ada are also special-cased so that searching locally and in anod should succeed as expected. The search order is: 1. path (using `which`) 2. local (obj/cpp/uxas or src/ada/uxas-ada) 3. anod (inside uxas-release or uxas-ada-release) run-example also follows similar logic in search for OpenAMASE: 1. specified via argument 2. local (develop/OpenAMASE) 3. anod (inside amse) I believe these have all been tested. Help / error strings have been updated so that they are consistent with the new infrastructure. Debug output has been improved to be more consistent with that provided by e3 (but doesn't actually directly use e3, still). This commit also improves the .gitignore for ada support and updates the Makefile so that it removes the binary on clean. * Update README and scripts. Create a temporary README with testing instructions. Also fix some issues in the debug output of the scripts (the $ was not escaped properly in some instances). * Relativize path to anod in run-example This looks nicer and better supports the common case: in which the user runs run-example from the repo root. * Fix python version in Makefile Makefile was using python to determine the platform; this was one of a few remaining non-python3 uses of `python`. Having fixed it, things seem to work smoothly on a machine where python ≠ python3. * Don't install GNAT CE by default. Most users won't want to build Ada, so offering to install GNAT CE by default is likely to just be confusing. * Change the way Java is installed. Rather than installing Java (OpenJDK 13) by way of anod in the sandbox, instead install Java (OpenJDK 11) by way of apt. This results in Java being available system-wide and avoids having to put ant/java on the path using anod commands for things like generating LMCP. Update workflows to install Java using the appropriate github action. This should reduce the number of spurious build failures we've encountered. * Fix run-example issue for uxas-ada. The shared library for uxas-ada wasn't being placed on the path. Additionally, there was an unconditional and unlogged exit leftover from testing in the python script. * Update anod self-install process to be automatic. Rather than running the install script in interactive mode, give the user a full message up front that explains what will happen, followed by a choice to continue. Then, run the install script in automatic mode. This avoids some confusion identified whereby the script seems to ask multiple times to do things in a way that's not particularly helpful when the expectation is that it will just "take care of things" for the user. * Update the README This new version of the README is tailored to the changes that were made to integrated -bootstrap into this repository. It is intended to be minimal and simple. Detail will be provided later to the documentation site that AFRL is setting up. Once that site is live, links will be made from this README to that site. * Improve script with debug_and_run Rather than printing the string for a command and then separately issuing the command, we pass the string form of the command to a debug print method and then eval the string. This removes duplication and ensures that the printed command really is the command that is executed. * Minor improvements to README Fix a couple of typos.
2021-04-01 15:30:51 -04:00
# Don't autoconfigure the build environment if this Makefile is invoked by anod
ifneq ($(SKIP_ANOD_SETUP),true)
# Anod search path
ANOD_PATH:=$(current_dir)
Bootstrap Integration (#24) * Integrate OpenUxAS-bootstrap into OpenUxAS This commit represents a complete, working integration along with several key enhancements. Note that the README is entirely unchanged and not suitable. ***NOTE: the build will fail currently because of a problem with e3*** e3 provides no way to modify the list of excluded globs for sync_tree; this will need to be fixed. The bootstrap script works and will download and install needed support for anod. The instructions printed at the end of the install are out of date; the user doesn't need to do anything more than call anod with ./anod build uxas The top-level anod script takes care of activating the python venv and then calls the python anod script. The user can also `source anod`, which will then register anod as a shell function, allowing simpler invocation and a working setenv command. Anod's devel setup no longer supports uxas, since that's superfluous. It does support lmcpgen and amase. They are placed in `develop` as before, although finding a better name for the containing directory seems nice. run-example works, as does resources/RunLmcpGen make works VS Code integration works There is definite room for improvement. Specifically, factoring the informtion about repository structure into some central set of includable scripts seems like it should be really useful. Likewise, anod's support should be a real python module so that it's easier to use. Finally, there's no reason not to automatically install the python venv and all needed support the first time anod is invokved (including from make). This would eliminate a needed step by the user. We could still retain the bootstrap script if desired. * Rename and create constants for repo structure This commit reorganizes the directories a bit and introduces better handling of pathnames through constants defined in paths.sh. Unfortunately, because of the way python handles environment variables, (and because we can't necessarily assume that python scripts are always invoked through shell scripts that call paths.sh) we have to duplicate a lot of the path information; this will hopefully be addressed in a future commit. * Refactor infrastructure and add github workflows. OpenUxAS anod support is now a proper python module named `uxas`. Paths within the uxas module are refactored. The module directory under infrastructure/uxas has the expected layout for a python module project and includes a tox.ini file so that tox can be used for development and in CI. infrastructure/install is now a script that calls into python scripts in infrastructure/install-libexec; these are not a proper python module, since that would create a chicken-and-egg problem. There is a tox.ini file here, too, for development and CI. infrastructure/bootstrap is the new bootstrap script, which is less useful now but still usable. Scripts have been updated as needed to take advantage of the uxas python module. In particular, anod and run-example check for the python venv and call into infrastructure/install if needed. * Add Ada support and improve scripts Added support for Ada back in by reactivating and updating install-gnat.py Added Ada build-prove workflow Refactored venv activation to paths.sh Added ensure_gnat, which will check for gnat on the path (via which) or will add a local install of GNAT CE to the path (if it's there) or will offer to install GNAT CE via install-gnat.py This means the user can always choose a different GNAT and it will be used; otherwise, the local install of GNAT CE will be used. Added wrapper shell scripts for the python testing and proof scripts so that the environment can be automatically configured. Updated the C++ workflow Note: sourcing anod and then running anod as a shell function isn't behaving quite right in either bash or zsh (and for different reasons). Needs further investigation. * Add debug output to print commands executed. This should address concern that users won't be able to figure out what the scripts are doing if things break and require manual intervention. Also modify the workflows so that they will run if critical scripts are updated. * Enhance run-example to better search for binaries. run-example now follows similar logic to run-tests in searching for binaries. uxas and uxas-ada are also special-cased so that searching locally and in anod should succeed as expected. The search order is: 1. path (using `which`) 2. local (obj/cpp/uxas or src/ada/uxas-ada) 3. anod (inside uxas-release or uxas-ada-release) run-example also follows similar logic in search for OpenAMASE: 1. specified via argument 2. local (develop/OpenAMASE) 3. anod (inside amse) I believe these have all been tested. Help / error strings have been updated so that they are consistent with the new infrastructure. Debug output has been improved to be more consistent with that provided by e3 (but doesn't actually directly use e3, still). This commit also improves the .gitignore for ada support and updates the Makefile so that it removes the binary on clean. * Update README and scripts. Create a temporary README with testing instructions. Also fix some issues in the debug output of the scripts (the $ was not escaped properly in some instances). * Relativize path to anod in run-example This looks nicer and better supports the common case: in which the user runs run-example from the repo root. * Fix python version in Makefile Makefile was using python to determine the platform; this was one of a few remaining non-python3 uses of `python`. Having fixed it, things seem to work smoothly on a machine where python ≠ python3. * Don't install GNAT CE by default. Most users won't want to build Ada, so offering to install GNAT CE by default is likely to just be confusing. * Change the way Java is installed. Rather than installing Java (OpenJDK 13) by way of anod in the sandbox, instead install Java (OpenJDK 11) by way of apt. This results in Java being available system-wide and avoids having to put ant/java on the path using anod commands for things like generating LMCP. Update workflows to install Java using the appropriate github action. This should reduce the number of spurious build failures we've encountered. * Fix run-example issue for uxas-ada. The shared library for uxas-ada wasn't being placed on the path. Additionally, there was an unconditional and unlogged exit leftover from testing in the python script. * Update anod self-install process to be automatic. Rather than running the install script in interactive mode, give the user a full message up front that explains what will happen, followed by a choice to continue. Then, run the install script in automatic mode. This avoids some confusion identified whereby the script seems to ask multiple times to do things in a way that's not particularly helpful when the expectation is that it will just "take care of things" for the user. * Update the README This new version of the README is tailored to the changes that were made to integrated -bootstrap into this repository. It is intended to be minimal and simple. Detail will be provided later to the documentation site that AFRL is setting up. Once that site is live, links will be made from this README to that site. * Improve script with debug_and_run Rather than printing the string for a command and then separately issuing the command, we pass the string form of the command to a debug print method and then eval the string. This removes duplication and ensures that the printed command really is the command that is executed. * Minor improvements to README Fix a couple of typos.
2021-04-01 15:30:51 -04:00
# Anod binary
ANOD_BIN:=$(ANOD_PATH)/anod
# Check if anod is available and export the uxas build environment if so
ifneq (,$(wildcard $(ANOD_BIN)))
ANODENV:=$(shell NO_INSTALL_VENV=1 $(ANOD_BIN) printenv uxas --build-env --inline)
else
ANODENV:=
endif
endif
# Control whether full command line should be displayed during compilation
DEBUG_BUILD=false
# Root directory in which the object and the final executable will be created
OBJECT_DIR=obj/cpp
# Root directory under which the source files live
SOURCE_DIR=src/cpp
# Source directories for the uxas project
SOURCE_DIRS:=$(SOURCE_DIR)/Communications \
$(SOURCE_DIR)/Includes \
$(SOURCE_DIR)/Services \
$(SOURCE_DIR)/Tasks \
$(SOURCE_DIR)/DPSS \
$(SOURCE_DIR)/Plans \
$(SOURCE_DIR)/Utilities \
$(SOURCE_DIR)/VisilibityLib \
resources/AutomationDiagramDataService
# Compiler to be used - note the prefixed anod env here
CXX=$(ANODENV)g++
# Default C++ compilation flags
CXX_FLAGS:=-fPIC -std=c++11
# Enable all warnings
ifeq ($(ENABLE_WARNINGS),true)
CXX_FLAGS+=-Wall
endif
# Enable coverage with gcov
ifeq ($(ENABLE_COVERAGE),true)
CXX_FLAGS+=-fprofile-arcs -ftest-coverage -DGCOV_MODE=1
endif
# Linker flags
2020-03-20 11:34:42 +01:00
ifeq ($(PLATFORM),linux)
LINKER_FLAGS:=-std=c++11 -llmcp -lzyre -lpugixml -lboost_filesystem \
-lboost_regex -lboost_date_time -lboost_system -lSQLiteCpp -lsqlite3 \
-lczmq -luuid -lserial -lzmq -ldl -lpthread -static-libstdc++ -static-libgcc
else
LINKER_FLAGS:=-std=c++11 -llmcp -lzyre -lpugixml -lboost_filesystem \
-lboost_regex -lboost_date_time -lboost_system -lSQLiteCpp -lsqlite3 \
-lczmq -lserial -lzmq -ldl -lpthread
endif
# Include flags
INCLUDES=$(foreach source_dir, $(SOURCE_DIRS), -I$(source_dir))
# The list of sources
SOURCES:=$(foreach source_dir, $(SOURCE_DIRS), $(wildcard $(source_dir)/*.cpp))
# The list of non relocated object files
OBJECTS_BASE:=$(patsubst %.cpp,%.o,$(SOURCES))
# The final location of all objects
OBJECTS:=$(foreach object, $(OBJECTS_BASE),$(OBJECT_DIR)/$(object))
# The list of Makefile fragments containing the dependencies
DEPS:=$(patsubst %.o,%.o.d,$(OBJECTS))
# COMPILE_CXX(object_file, source_file)
#
# Compile a C++ source and generate Makefile dependencies
#
define COMPILE_CXX
@mkdir -p `dirname $1`
@echo "[Compiling $2]"
@if test "$(DEBUG_BUILD)" = "true"; then \
echo "$(CXX) $(CXX_FLAGS) $(INCLUDES) -MM -MT $1 $2 -MF $1.d"; \
fi
@$(CXX) $(CXX_FLAGS) $(INCLUDES) -MM -MT $1 $2 -MF $1.d
@if test "$(DEBUG_BUILD)" = "true"; then \
echo "$(CXX) -c $2 $(INCLUDES) $(CXX_FLAGS) -o $1"; \
fi
@$(CXX) -c $2 $(INCLUDES) $(CXX_FLAGS) -o $1
endef
# GENERATE_COMPILER_RULE(object_file, source_file)
#
# Generate a makefile rule to compile a C++ source
#
define GENERATE_COMPILE_RULE
$(OBJECT_DIR)/$1: $2
$$(call COMPILE_CXX,$$@,$$<)
endef
# Toplevel targets
help:
@echo "This makefile compiles the uxas main executable"
@echo
@echo "It assumes that thirdparties libraries and their respective include files"
@echo "are available in the environment (either in the system paths or using"
@echo "environment variables)"
@echo
@echo "Available targets:"
@echo " all: Compile the project"
@echo " clean: Clean all build artefacts"
@echo " help: This target"
@echo
@echo "User variables:"
@echo " DEBUG_BUILD: if 'true' then display full compilation command line"
@echo " OBJECT_DIR: root directory containing objects and executable (default: 'obj')"
@echo " ENABLE_WARNINGS: if 'true' enable all C++ warnings"
@echo " ENABLE_COVERAGE: if 'true' compile uxas with gcov enabled"
clean:
@echo "[Remove objects]"
rm -f $(OBJECTS)
Bootstrap Integration (#24) * Integrate OpenUxAS-bootstrap into OpenUxAS This commit represents a complete, working integration along with several key enhancements. Note that the README is entirely unchanged and not suitable. ***NOTE: the build will fail currently because of a problem with e3*** e3 provides no way to modify the list of excluded globs for sync_tree; this will need to be fixed. The bootstrap script works and will download and install needed support for anod. The instructions printed at the end of the install are out of date; the user doesn't need to do anything more than call anod with ./anod build uxas The top-level anod script takes care of activating the python venv and then calls the python anod script. The user can also `source anod`, which will then register anod as a shell function, allowing simpler invocation and a working setenv command. Anod's devel setup no longer supports uxas, since that's superfluous. It does support lmcpgen and amase. They are placed in `develop` as before, although finding a better name for the containing directory seems nice. run-example works, as does resources/RunLmcpGen make works VS Code integration works There is definite room for improvement. Specifically, factoring the informtion about repository structure into some central set of includable scripts seems like it should be really useful. Likewise, anod's support should be a real python module so that it's easier to use. Finally, there's no reason not to automatically install the python venv and all needed support the first time anod is invokved (including from make). This would eliminate a needed step by the user. We could still retain the bootstrap script if desired. * Rename and create constants for repo structure This commit reorganizes the directories a bit and introduces better handling of pathnames through constants defined in paths.sh. Unfortunately, because of the way python handles environment variables, (and because we can't necessarily assume that python scripts are always invoked through shell scripts that call paths.sh) we have to duplicate a lot of the path information; this will hopefully be addressed in a future commit. * Refactor infrastructure and add github workflows. OpenUxAS anod support is now a proper python module named `uxas`. Paths within the uxas module are refactored. The module directory under infrastructure/uxas has the expected layout for a python module project and includes a tox.ini file so that tox can be used for development and in CI. infrastructure/install is now a script that calls into python scripts in infrastructure/install-libexec; these are not a proper python module, since that would create a chicken-and-egg problem. There is a tox.ini file here, too, for development and CI. infrastructure/bootstrap is the new bootstrap script, which is less useful now but still usable. Scripts have been updated as needed to take advantage of the uxas python module. In particular, anod and run-example check for the python venv and call into infrastructure/install if needed. * Add Ada support and improve scripts Added support for Ada back in by reactivating and updating install-gnat.py Added Ada build-prove workflow Refactored venv activation to paths.sh Added ensure_gnat, which will check for gnat on the path (via which) or will add a local install of GNAT CE to the path (if it's there) or will offer to install GNAT CE via install-gnat.py This means the user can always choose a different GNAT and it will be used; otherwise, the local install of GNAT CE will be used. Added wrapper shell scripts for the python testing and proof scripts so that the environment can be automatically configured. Updated the C++ workflow Note: sourcing anod and then running anod as a shell function isn't behaving quite right in either bash or zsh (and for different reasons). Needs further investigation. * Add debug output to print commands executed. This should address concern that users won't be able to figure out what the scripts are doing if things break and require manual intervention. Also modify the workflows so that they will run if critical scripts are updated. * Enhance run-example to better search for binaries. run-example now follows similar logic to run-tests in searching for binaries. uxas and uxas-ada are also special-cased so that searching locally and in anod should succeed as expected. The search order is: 1. path (using `which`) 2. local (obj/cpp/uxas or src/ada/uxas-ada) 3. anod (inside uxas-release or uxas-ada-release) run-example also follows similar logic in search for OpenAMASE: 1. specified via argument 2. local (develop/OpenAMASE) 3. anod (inside amse) I believe these have all been tested. Help / error strings have been updated so that they are consistent with the new infrastructure. Debug output has been improved to be more consistent with that provided by e3 (but doesn't actually directly use e3, still). This commit also improves the .gitignore for ada support and updates the Makefile so that it removes the binary on clean. * Update README and scripts. Create a temporary README with testing instructions. Also fix some issues in the debug output of the scripts (the $ was not escaped properly in some instances). * Relativize path to anod in run-example This looks nicer and better supports the common case: in which the user runs run-example from the repo root. * Fix python version in Makefile Makefile was using python to determine the platform; this was one of a few remaining non-python3 uses of `python`. Having fixed it, things seem to work smoothly on a machine where python ≠ python3. * Don't install GNAT CE by default. Most users won't want to build Ada, so offering to install GNAT CE by default is likely to just be confusing. * Change the way Java is installed. Rather than installing Java (OpenJDK 13) by way of anod in the sandbox, instead install Java (OpenJDK 11) by way of apt. This results in Java being available system-wide and avoids having to put ant/java on the path using anod commands for things like generating LMCP. Update workflows to install Java using the appropriate github action. This should reduce the number of spurious build failures we've encountered. * Fix run-example issue for uxas-ada. The shared library for uxas-ada wasn't being placed on the path. Additionally, there was an unconditional and unlogged exit leftover from testing in the python script. * Update anod self-install process to be automatic. Rather than running the install script in interactive mode, give the user a full message up front that explains what will happen, followed by a choice to continue. Then, run the install script in automatic mode. This avoids some confusion identified whereby the script seems to ask multiple times to do things in a way that's not particularly helpful when the expectation is that it will just "take care of things" for the user. * Update the README This new version of the README is tailored to the changes that were made to integrated -bootstrap into this repository. It is intended to be minimal and simple. Detail will be provided later to the documentation site that AFRL is setting up. Once that site is live, links will be made from this README to that site. * Improve script with debug_and_run Rather than printing the string for a command and then separately issuing the command, we pass the string form of the command to a debug print method and then eval the string. This removes duplication and ensures that the printed command really is the command that is executed. * Minor improvements to README Fix a couple of typos.
2021-04-01 15:30:51 -04:00
rm -rf $(OBJECT_DIR)/uxas
@echo "[Remove makefile fragments (dependencies)]"
rm -f $(DEPS)
all: $(OBJECT_DIR)/uxas
@echo "[Project compiled]"
# Main compilation and link
$(OBJECT_DIR)/uxas.o: $(SOURCE_DIR)/UxAS_Main.cpp
$(call COMPILE_CXX,$@,$<)
$(OBJECT_DIR)/uxas: $(OBJECT_DIR)/uxas.o $(OBJECTS)
@echo "[Link uxas main]"
@$(CXX) -o $@ $^ $(LINKER_FLAGS) $(CXX_FLAGS)
# Create a compilation rule for each source found
$(foreach object, $(OBJECTS_BASE), $(eval $(call GENERATE_COMPILE_RULE,$(object),$(patsubst %.o,%.cpp, $(object)))))
# Include the Makefile fragments containing the dependencies
-include $(DEPS)