Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve expand rule #146

Open
jimon opened this issue Mar 22, 2016 · 6 comments
Open

Improve expand rule #146

jimon opened this issue Mar 22, 2016 · 6 comments

Comments

@jimon
Copy link
Member

jimon commented Mar 22, 2016

Now if you write something like build objects(build/*): auto src1/*.c src2/temp.c you will get ValueError: cannot expand rule cc because of different amount of explicit generated targets and explicit inputs ... which is just bad UX. We really need to improve it!

@jimon jimon added this to the v0.3 release milestone Mar 22, 2016
@den-mentiei den-mentiei mentioned this issue Jun 12, 2016
3 tasks
@Mucka
Copy link

Mucka commented Nov 3, 2016

I have simple question. In given example build objects(build/*): auto src1/*.c src2/temp.c, how to properly achieve this ? I mean, I want to add a single file from src2 to every file from src1 and compile
it together. It this possible to write such generic statement in current version ?

@jimon
Copy link
Member Author

jimon commented Nov 3, 2016

@Mucka at the moment what we are doing is something like this :

build objects(build/src1/*): auto src1/*.c
build objects(build/src2/temp): auto src2/temp.c
build application(build/app): auto objects(build/**/*)

where build/srcX/ is needed so if we two files with the same name temp.c in src1 and src2 - object files to not collide.

This should be fixed later on. Currently we are testing build system extensively in our hobbie projects to see what we like and what we want to change.

@Mucka
Copy link

Mucka commented Nov 3, 2016

Thank for your answer! I have system with lots of unit tests. And every module have multiple files with tests grouped like: test/unit/<module>/test_<name>.c and each of such file need to be linked with src/<module>.c. So I thought if I can write build application(build/test/unit/**/bin/*): auto objects(build/test/unit/**/obj/*) objects(build/obj/*) or something similar to achieve such behaviour (with expand turned on in custom rule or something). Something like this works with implicit inputs, so I understand I need some mix of explicit and implicit input functionality. I even tried solution where I write one line in script per module like build application(build/test/unit/example/bin/*): auto objects(build/test/unit/example/obj/*) objects(build/obj/example.c) but it still do not works, so I will now try to somehow adapt your answer to my needs.

@jimon
Copy link
Member Author

jimon commented Nov 3, 2016

@Mucka Can't all of them just be linked together? Or you get linker conflicts? Usually unit tests are just separate object files that all end up in one application.

@Mucka
Copy link

Mucka commented Nov 3, 2016

@jimon For now, every each test have separate main function and eventually ends as separate application. This is embedded application, test were designed to be as small as possible, to be able to run them on hardware eventually, for now the unit test platform is qemu so this is not necessity. The unit test platform is custom stuff based on ThrowTheSwitch/Unity.

@jimon
Copy link
Member Author

jimon commented Nov 3, 2016

Ah ok, indeed this use case is not really trivial for our build system :\ Maybe it's feasible to put every object + test case for it in separate folder? So you can build them folder by folder case. And then build a final application by getting all object files recursively and ignoring specific prefix (test_) in the path. You can ignore by doing something like build ... : auto "path/!(test)_*.c"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants