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

Could sources are amalgamated into a monolithic c file during configure? #757

Open
winterland1989 opened this issue Jul 26, 2023 · 7 comments

Comments

@winterland1989
Copy link

I'm trying to use blis with Haskell, the Haskell build system cabal needs a complete list of C sources to be listed in order, which is hard to track due to many configure possibilities. So is it possible to provide a flat_sources script and get a monolithic c file contain all symbols during configure?

@devinamatthews
Copy link
Member

The Makefile keeps a list of all objects in the MK_BLIS_OBJS variable, so you could hack the Makefile to print this out. However, some files will be compiled with different flags. If you're only building one sub-configuration (e.g. configure haswell) then you could get away with a single set of flags either pulled from BLIS or specified externally.

Alternatively, you could use a tool like bear to instrument the build and construct a compilation database.

@devinamatthews
Copy link
Member

FYI in addition to object files, there are also lists (note plural) of source files which are used to generate the object list. I can't recall all of these ATM but you should be able to backtrack in the Makefile and find them.

@winterland1989
Copy link
Author

Yeah I could do it manually, but if a flat_sources.py is provided officially then things could be easier.

@devinamatthews
Copy link
Member

Any comment about compiler flags? If it's just a matter of jamming all of the .c files together then we could probably hack something together.

@winterland1989
Copy link
Author

You mean if we choose a configure family like arm64 or x86_64 then different sub-families need different compile flag right? We can put limits on possible configurations from the cabal side, so that each cabal flag chooses one single sub-configuration, and in flat_sources.py this condition is checked too so that it can output a single file with flags needed.

@fgvanzee
Copy link
Member

You mean if we choose a configure family like arm64 or x86_64 then different sub-families need different compile flag right?

@winterland1989 Yes, but it actually goes beyond just the sub-configurations needing different compiler flags. Even when just one sub-configuration is targeted, different parts of the framework are compiled with different sets of flags.

To see the full list of possible classes of CFLAGS used, take a look at the make functions defined in the section labeled "CFLAGS query functions" within common.mk.

@winterland1989
Copy link
Author

Thanks! I'll try a implement a different way to build blis with cabal then.

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

No branches or pull requests

3 participants