I switched from make to tup and am trying to get it to build different variants (debug and production). My source tree looks like this:
| .tup
| bin
| build_debug
| | tup.config
| build_default
| | tup.config
| include (headers directory)
| src (source files directory)
| | runs (directory containing additional source files)
| Tupfile
And my Tupfile
:
preload bin
preload src
preload src/runs
COMPILER = g++
ifeq (@(DEBUG),y)
FLAGS = -Wall -std=c++17 -O0 -g
else
FLAGS = -Wall -std=c++17 -O3 -march=native -flto -pipe
endif
: foreach src/*.cc src/runs/*.cc |> $(COMPILER) -c %f -o %o $(FLAGS) |> %B.o
: src/*.o src/runs/*.o |> $(COMPILER) %f -o %o $(FLAGS) |> bin/a.out
I want this to create object files within the src
directories and a binary within the bin
directories inside the build*
directories.
When I run tup
, it will create object files directly inside the build*
directories (so not inside the build*/src
directories) and not create any binaries.
What am I doing wrong?
Edit:
When building inside the base directory without any build*
directories it will create a binary but also place the object files within the base directory and not inside src
.