flame / blis

BLAS-like Library Instantiation Software Framework

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

winterland1989 opened this issue · comments

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?

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.

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.

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

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.

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.

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.

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