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

Rewamp build system #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Rewamp build system #10

wants to merge 2 commits into from

Conversation

tharvik
Copy link

@tharvik tharvik commented Jan 19, 2019

So, I was trying to build it as a shared lib, with the CC/CFLAGS/LDFLAGS I wanted, but the makefiles doesn't allow that. As I was adding it, I found some over-customisation (IMHO), such as the DELETE variable and many code duplication. And my small patch kept growing bigger, so I rewrote most of it, trying to commonize logic and identical variable.

I think it's a better design but I might have overlooked some wanted features of the old one; it's a proposal. Also, I wasn't able to tests all builds, don't have a Windows, don't have an ARM.

build
├── Linux-386-GCC # for example, the others are alike
│   └── Makefile # contains only SPECIALIZE_TYPE and wanted CFLAGS then include templates/not-FAST_INT64/template.mk
...
└── templates # contains the common logic
    ├── FAST_INT64 # same idea in not-FAST_INT64
    │   ├── platform.h # it's the same between all the FAST_INT64 anyway, so copying it here
    │   └── template.mk # specific CFLAGS and OBJS_* definition then include templates/common.mk
    ├── common.mk # main logic part: common flags, the rules of the makefile, use the previously defined variables
...

With this PR, it's easy to build a shared lib (make SHARED=y), build out of tree, use another compiler (ccache for eg), specific the wanted build flags (for source based distro)...

Btw, by playing with CFLAGS, if you remove the -O2, some build will fail to link (or rather, it will fail to link the final binary). It's because the inlining done when using opts-GCC.h doesn't generate a symbol, because inline is a weird keyword, see this good answer on stackoverflow. Adding the prototype, in the C files where the overridden is effective, fixes it.

While I'm at it, building a shared lib need a good SONAME, but I'm not sure of the binary compatibility being kept; there is not support for it now but it's trivial to add. Also, why outputing to softfloat.a and not libsoftfloat.a, it's not standard so GCC won't find it with the classic gcc -lsoftfloat?

Verified

This commit was signed with the committer’s verified signature.
tharvik Valérian Rousset

Verified

This commit was signed with the committer’s verified signature.
tharvik Valérian Rousset
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

Successfully merging this pull request may close these issues.

None yet

1 participant