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

use default CC, with std=c99 #22

Closed
wants to merge 4 commits into from
Closed

use default CC, with std=c99 #22

wants to merge 4 commits into from

Conversation

simonbyrne
Copy link
Member

No description provided.

src/Makefile Outdated
@@ -10,15 +10,15 @@ else
XOBJS = $(DOBJS)
endif

CFLAGS-add += -DMATHLIB_STANDALONE
CFLAGS-add += -std=c99 -DMATHLIB_STANDALONE
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c99 is pickier than gnu99, I'd avoid changing that

Copy link
Member Author

@simonbyrne simonbyrne Aug 16, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it uses any of the GNU features: http://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes
and I thought it might make it more general (e.g. for use with icc and the like).

default: release

%.o: %.c
$(CC) $(CPPFLAGS) $(CFLAGS-add) $(CFLAGS) $(fPIC) -std=gnu99 -I../include -DNDEBUG -c $< -o $@
$(CC) $(CPPFLAGS) $(CFLAGS) $(CFLAGS-add) $(fPIC) -DMATHLIB_STANDALONE -I../include -DNDEBUG -c $< -o $@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you'll still have to specify C99 somewhere in here; the tests are failing because it isn't assuming C99.

@simonbyrne
Copy link
Member Author

Seems to be working now.

@yurivict
Copy link

yurivict commented Apr 3, 2018

BTW, it's also wrong to add -O3. CFLAGS/CXXFLAGS are supposed to have all needed optimization flags.

@simonbyrne
Copy link
Member Author

Thanks. I admit I don't have a lot of experience with writing Makefiles: is there any standard guidance for what should go where? Or do people just copy whatever autoconf does?

@yurivict
Copy link

yurivict commented Apr 3, 2018

I edited/created many FreeBSD ports, and since many projects use gmake that's where my knowledge came from. Otherwise, there's no good reference that I know of.

@simonbyrne
Copy link
Member Author

simonbyrne commented Apr 3, 2018 via email

@ararslan
Copy link
Member

ararslan commented Apr 3, 2018

I think it's okay to set optimization levels in this case, since the vast majority of users won't be passing any kind of special flags for building. This primarily just gets built for use with Rmath.jl, rather than as a library for general distribution as with a FreeBSD port, and there isn't an easy way within Julia's Pkg framework for custom build configurations. Thus it makes the most sense to me to provide a sensible default optimization level here. For reference, we also set -O3 when building Julia in release mode.

@yurivict
Copy link

yurivict commented Apr 3, 2018

When gmake is called, it picks flags from /etc/make.conf. Users are expected to have /etc/make.conf with all correct flags, that's how GNU make works.

@ararslan
Copy link
Member

ararslan commented Apr 3, 2018

Right, that applies to FreeBSD, but I don't think make.conf is a thing on most systems. Based on a quick Google search, it seems to apply to FreeBSD, DragonFly, and Gentoo Linux.

@yurivict
Copy link

yurivict commented Apr 3, 2018

Such lack of standard is what messes GNU make up. There is no generally correct way.

@yurivict
Copy link

yurivict commented Apr 3, 2018

It's ok, put back -O3 it you want to.

@ViralBShah ViralBShah closed this Aug 9, 2024
@ararslan ararslan deleted the sb/cc branch August 9, 2024 21:42
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.

5 participants