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

For C flags, only use CFLAGS environment variable #544

Merged
merged 2 commits into from
May 26, 2022
Merged

For C flags, only use CFLAGS environment variable #544

merged 2 commits into from
May 26, 2022

Conversation

hugomg
Copy link
Member

@hugomg hugomg commented May 24, 2022

To address #516, I'm planning to use Luarocks as a compilation backend. If we set things up the right way, we should be able to use Luarocks to compile our c files into shared libraries, in a cross-platform manner.

This PR has some CFLAGS-related changes to pave the way for that. When using Luarocks to build C modules, the only way to pass CFLAGS is via the CFLAGS environment variable. So what this commit does is take the flags we were passing directly in the c_compiler.lua and passing them via CFLAGS environment variable instead. This implies in a change in behavior. By default we will no longer compile with -g and -Wall. IMO, that might actually be a good thing. The -g causes larger executables and the -Wall is not relevant to end-users. (I'm still leaving the -Wall in the ./run-tests though)

@hugomg hugomg changed the title Cflags For C flags, only use CFLAGS environment variable May 24, 2022
Now, the official way to affect the C compiler is to use the CFLAGS
environment variable. This is a cleaner separation of duties. It also
paves the way for using Luarocks as the compilation backend, because
Luarocks only allows setting custom flags via the CFLAGS environment
variable.
This removes debugging (-g) and warning (-W) flags in a default
invocation of pallenec. Again, the main reason is to pave the road for
the Luarocks compilation backend, which requires that any custom flags
be passed via the CFLAGS environment variable. However, I think it is
still a good idea despite that. Removing -g leads to smaller binaries
and faster compilation times. As for the warning-related flags, they are
not relevant to Pallene end-users, they are only relevant to us who are
writing the compiler.
@hugomg hugomg merged commit 1a369b2 into master May 26, 2022
@hugomg hugomg deleted the cflags branch May 26, 2022 20:58
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.

2 participants