Make plugin¶
Description¶
The make plugin is used for executing Makefiles.
Mandatory settings¶
There are no mandatory settings for this plugin.
Optional settings¶
The configuration of the make plugin may contain the following settings:
-
patterns
A list of patterns to apply on the command line. See Patterns (5).
-
enviroment
A list of environment variables that should be set before the commands are executed. See Environment (5).
-
command-line
Additional command line parameters to pass as a list of separate arguments. By default no additional arguments are added.
-
working-dir
The working directory of the command. Can be an absolute path are a relative one w.r.t. the path to the considered configuration file. Commands that should be executed relative to the current working dir can use the
{EH_WORKING_DIR}
pattern.
-
build-dir
The path to the Makefile. This is either an absolute path are a path relative to the location of this file. Default:
.
(the current working directory).
Example¶
Configuration¶
commands: # Define the commands that can be run
example: Run the make example
clean: Clean the build
run: Run the files that were built
patterns: # Define the patterns that can be used
MAKE_TARGET: # Define the EXAMPLE_PATTERN.
default-values: # Only define the default value
- hello
- world
example:
- clean
- make # Use the make plugin when running the 'example' command
- run
clean: # Use the make plugin when running the 'clean' command
- make
run:
- command-line-command
make:
environment: # Define additional environment variables
WORLD: "world!"
example: # Specific settings for the 'example' command
patterns: # The patterns that are used by the make plugins
- MAKE_TARGET
build-dir: $(pwd) # Set the build dir
command-line: # Define additional command line arguments
- --keep-going # An example argument passed to make
- "{MAKE_TARGET}" # Define the make target to execute
clean:
command-line:
- clean
command-line-command:
patterns:
- MAKE_TARGET
command-line:
- build/{MAKE_TARGET}
Additional files¶
In order for the above example to work, the following file hierarchy needs to be created in the directory:
Makefile:
CXX=g++
CXXFLAGS+=-O0 -g --coverage
LDFLAGS+=
SRC_DIR=src
BUILD_DIR=build
hello:
mkdir -p $(BUILD_DIR)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/hello $(SRC_DIR)/hello.cpp
world:
mkdir -p $(BUILD_DIR)
$(CXX) $(CXXFLAGS) $(LDFLAGS) -o $(BUILD_DIR)/world $(SRC_DIR)/world.cpp
clean:
rm -rf $(BUILD_DIR)
.PHONY: clean
hello.cpp:
#include <cstdlib>
#include <iostream>
auto main() -> int {
std::cout << "Hello" << std::endl;
return EXIT_SUCCESS;
}
world.cpp:
#include <cstdlib>
#include <iostream>
auto main() -> int {
std::cout << "World!" << std::endl;
return EXIT_SUCCESS;
}
Usage¶
Save the example to an exec-helper configuration file and execute in the same directory:
eh example
See also¶
See exec-helper (1) for information about the usage of exec-helper.
See Custom plugins (5) for the available plugins and their configuration options.
See Configuration (5) for information about the configuration file format.