Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
e7651c9c
Commit
e7651c9c
authored
6 years ago
by
Matthias Grob
Committed by
Daniel Agar
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Makefile: streamline cmake-build and
cleanup nuttx_, _default targets
parent
ca92b801
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Makefile
+23
-20
23 additions, 20 deletions
Makefile
with
23 additions
and
20 deletions
Makefile
+
23
−
20
View file @
e7651c9c
############################################################################
#
# Copyright (c) 2015 - 201
7
PX4 Development Team. All rights reserved.
# Copyright (c) 2015 - 201
9
PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
...
...
@@ -142,11 +142,18 @@ endif
# --------------------------------------------------------------------
# describe how to build a cmake config
define
cmake-build
+@
$(
eval
PX4_CONFIG
=
$(
1
))
+@
$(
eval
BUILD_DIR
=
"
$(
SRC_DIR
)
"
/build/
$(
PX4_CONFIG
)$(
BUILD_DIR_SUFFIX
))
+@if
[
$(PX4_CMAKE_GENERATOR)
=
"Ninja"
]
&&
[
-e
$(
BUILD_DIR
)
/Makefile
]
;
then
rm
-rf
$(
BUILD_DIR
);
fi
+@if
[
!
-e
$(BUILD_DIR)/CMakeCache.txt
];
then
mkdir
-p
$(BUILD_DIR)
&&
cd
$(BUILD_DIR)
&&
cmake
"$(SRC_DIR)"
-G
"$(PX4_CMAKE_GENERATOR)"
$(CMAKE_ARGS)
-DCONFIG
=
$(
PX4_CONFIG
)
||
(
rm
-rf
$(
BUILD_DIR
)
)
;
fi
+@$(PX4_MAKE)
-C
$(BUILD_DIR)
$(PX4_MAKE_ARGS)
$(ARGS)
@
$(
eval
BUILD_DIR
=
"
$(
SRC_DIR
)
/build/
$(
1
)
"
)
@
# make sure to start from scratch when switching from GNU Make to Ninja
@if
[
$(PX4_CMAKE_GENERATOR)
=
"Ninja"
]
&&
[
-e
$(
BUILD_DIR
)
/Makefile
]
;
then
rm
-rf
$(
BUILD_DIR
);
fi
@
# only excplicitly configure the first build, if cache file already exists the makefile will rerun cmake automatically if necessary
@if
[
!
-e
$(BUILD_DIR)/CMakeCache.txt
];
then
\
mkdir
-p
$(BUILD_DIR)
\
&&
cd
$(BUILD_DIR)
\
&&
cmake
"$(SRC_DIR)"
-G
"$(PX4_CMAKE_GENERATOR)"
$(CMAKE_ARGS)
\
||
(rm
-rf
$(BUILD_DIR));
\
fi
@
# run the build for the specified target
@cmake
--build
$(BUILD_DIR)
--
$(PX4_MAKE_ARGS)
$(ARGS)
endef
COLOR_BLUE
=
\0
33[0
;
94m
...
...
@@ -159,28 +166,24 @@ endef
# Get a list of all config targets boards/*/*.cmake
ALL_CONFIG_TARGETS
:=
$(
shell find boards
-maxdepth
3
-mindepth
3
!
-name
'*common*'
!
-name
'*sdflight*'
-name
'*.cmake'
-print
|
sed
-e
's/boards\///'
|
sed
-e
's/\.cmake//'
|
sed
-e
's/\//_/g'
|
sort
)
# Strip off default
CONFIG_TARGETS_DEFAULT
:=
$(
patsubst %_default,%,
$(
filter %_default,
$(
ALL_CONFIG_TARGETS
)))
# ADD CONFIGS HERE
# --------------------------------------------------------------------
# Do not put any spaces between function arguments.
# All targets.
$(ALL_CONFIG_TARGETS)
:
$(
call cmake-build,
$@
)
# Abbreviated config targets.
# nuttx_ is left off by default; provide a rule to allow that.
$(NUTTX_CONFIG_TARGETS)
:
$(
call cmake-build,nuttx_
$@
)
all_nuttx_targets
:
$(NUTTX_CONFIG_TARGETS)
@$(
eval
PX4_CONFIG
=
$@
)
@$(
eval
CMAKE_ARGS +
=
-DCONFIG
=
$(
PX4_CONFIG
))
@$(
call cmake-build,
$(
PX4_CONFIG
)$(
BUILD_DIR_SUFFIX
))
# Filter for only default targets to allow omiting the "_default" postfix
CONFIG_TARGETS_DEFAULT
:=
$(
patsubst %_default,%,
$(
filter %_default,
$(
ALL_CONFIG_TARGETS
)))
$(CONFIG_TARGETS_DEFAULT)
:
$(
call cmake-build,
$@
_default
)
@$(
eval
PX4_CONFIG
=
$@
_default
)
@$(
eval
CMAKE_ARGS +
=
-DCONFIG
=
$(
PX4_CONFIG
))
@$(
call cmake-build,
$(
PX4_CONFIG
)$(
BUILD_DIR_SUFFIX
))
all_config_targets
:
$(ALL_CONFIG_TARGETS)
all_default_targets
:
$(CONFIG_TARGETS_DEFAULT)
posix
:
px4_sitl_default
...
...
@@ -199,7 +202,7 @@ posix_sitl_default:
$(
MAKE
)
px4_sitl_default
# All targets with just dependencies but no recipe must either be marked as phony (or have the special @: as recipe).
.PHONY
:
all posix px4_sitl_default all_
nuttx
_targets all_default_targets
.PHONY
:
all posix px4_sitl_default all_
config
_targets all_default_targets
# Multi- config targets.
eagle_default
:
atlflight_eagle_default atlflight_eagle_qurt-default
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment