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

OBJECT values in subdirs are created in the base dir #400

Open
FGasper opened this issue Jun 30, 2021 · 6 comments
Open

OBJECT values in subdirs are created in the base dir #400

FGasper opened this issue Jun 30, 2021 · 6 comments

Comments

@FGasper
Copy link
Contributor

FGasper commented Jun 30, 2021

If I do:

WriteMakefile(
    # …
    OBJECT => [ 'foo/bar.o' ],
);

… then bar.o gets created in the base dir, not in foo/.

Note that this does compile foo/bar.c; it just doesn’t put the object file where it is meant to go.

This seems like pretty undesirable behaviour. It seems like it should be either fixed (i.e., put the object file where I said to put it) or at least documented.

If necessary, maybe make the fixed version an opt-in affair?

@FGasper
Copy link
Contributor Author

FGasper commented Jun 30, 2021

The workaround that alh found in #xs is: CCFLAGS => "$Config{ccflags} -o \$@".

@mohawk2
Copy link
Member

mohawk2 commented Jul 4, 2021

I don't think there's a good fix that would be backwards-compatible, since this is very long-standing behaviour across many C compilers.

@FGasper
Copy link
Contributor Author

FGasper commented Jul 5, 2021

@mohawk2 What if an enum-string were added, like:

OBJECTFILEMODE => 'givendir',   # default = 'basedir'

That way authors can adopt the new/fixed behaviour, and nothing will disrupt existing projects.

@Leont
Copy link
Member

Leont commented Jul 5, 2021

To be honest, this general area of MakeMaker has proven to be so fragile that I'm worried about any such change causing a lot of breakage.

Having some more compilation infrastructure so we can do this sort of thing in an extension would probably be safer.

@FGasper
Copy link
Contributor Author

FGasper commented Jul 6, 2021

If (as I kind of expected) there’s this much aversion to touching the relevant code paths, it’s maybe best just to document the quirk.

@mohawk2
Copy link
Member

mohawk2 commented Aug 3, 2021

Docs would probably be a good idea. Something else to try would be XSMULTI/XSBUILD since I expect any OBJECT will be intended for XS usage.

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