-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added t8117, t8118, t8119 - support for variants in subdirectories.
Variants were originally limited to be subdirectories of the top-level directory (ie: siblings of the .tup directory itself). This was largely to simplify the already complex problem of creating variants in the first place, but now it appears to be an artificial limitation. Fixing this mostly involved removing the safeguards that prevented creating variants in subdirectories, as well as better support for printing multi-part variant directories in print_tup_entry(). You still can't create a variant inside another variant, which is what t8118 and t8119 check for. But you can create a single "builds" directory and create all variants inside of that, for example.
- Loading branch information
Showing
12 changed files
with
213 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#! /bin/sh -e | ||
# tup - A file-based build system | ||
# | ||
# Copyright (C) 2012-2024 Mike Shal <marfey@gmail.com> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 2 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
|
||
# Try a variant in a subdir not in a parent of the main dir. | ||
. ./tup.sh | ||
|
||
mkdir builds | ||
mkdir builds/variant1 | ||
mkdir builds/variant2 | ||
mkdir sub | ||
|
||
cat > Tupfile << HERE | ||
srcs += baz.c | ||
ifeq (@(FOO),y) | ||
srcs += foo.c | ||
endif | ||
: foreach \$(srcs) |> gcc -c %f -o %o |> %B.o | ||
HERE | ||
cat > sub/Tupfile << HERE | ||
: foreach bar.c |> gcc -c %f -o %o |> %B.o | ||
HERE | ||
echo "int main(void) {return 0;}" > foo.c | ||
echo "CONFIG_FOO=y" > builds/variant1/tup.config | ||
echo "CONFIG_FOO=n" > builds/variant2/tup.config | ||
touch sub/bar.c baz.c foo.c | ||
update | ||
|
||
check_exist builds/variant1/foo.o builds/variant1/baz.o builds/variant1/sub/bar.o | ||
check_exist builds/variant2/baz.o builds/variant2/sub/bar.o | ||
check_not_exist builds/variant2/foo.o | ||
|
||
eotup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#! /bin/sh -e | ||
# tup - A file-based build system | ||
# | ||
# Copyright (C) 2012-2024 Mike Shal <marfey@gmail.com> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 2 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
|
||
# Try a variant inside another variant. | ||
. ./tup.sh | ||
|
||
mkdir build | ||
mkdir sub | ||
|
||
cat > Tupfile << HERE | ||
srcs += baz.c | ||
ifeq (@(FOO),y) | ||
srcs += foo.c | ||
endif | ||
: foreach \$(srcs) |> gcc -c %f -o %o |> %B.o | ||
HERE | ||
cat > sub/Tupfile << HERE | ||
: foreach bar.c |> gcc -c %f -o %o |> %B.o | ||
HERE | ||
echo "int main(void) {return 0;}" > foo.c | ||
echo "CONFIG_FOO=y" > build/tup.config | ||
touch sub/bar.c baz.c foo.c | ||
update | ||
|
||
check_exist build/foo.o build/baz.o build/sub/bar.o | ||
|
||
mkdir build/build2 | ||
touch build/build2/tup.config | ||
|
||
update_fail_msg "Unable to clean up old directory in the build tree:" | ||
|
||
eotup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#! /bin/sh -e | ||
# tup - A file-based build system | ||
# | ||
# Copyright (C) 2012-2024 Mike Shal <marfey@gmail.com> | ||
# | ||
# This program is free software; you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License version 2 as | ||
# published by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, write to the Free Software Foundation, Inc., | ||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
|
||
# Like t8118, but this time both the variant and the sub variant are created at | ||
# the same time. This goes to a slightly different error path. | ||
. ./tup.sh | ||
|
||
mkdir build | ||
mkdir build/build2 | ||
mkdir sub | ||
|
||
cat > Tupfile << HERE | ||
srcs += baz.c | ||
ifeq (@(FOO),y) | ||
srcs += foo.c | ||
endif | ||
: foreach \$(srcs) |> gcc -c %f -o %o |> %B.o | ||
HERE | ||
cat > sub/Tupfile << HERE | ||
: foreach bar.c |> gcc -c %f -o %o |> %B.o | ||
HERE | ||
echo "int main(void) {return 0;}" > foo.c | ||
echo "CONFIG_FOO=y" > build/tup.config | ||
touch sub/bar.c baz.c foo.c | ||
touch build/build2/tup.config | ||
|
||
update_fail_msg "Variant directory must only contain a tup.config file. Found extra files:" | ||
|
||
eotup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters