Solved [Solved] gmake reading Makefile, not GNUmakefile & other qs

GNU make reading the wrong makefile
I am creating a port that needs GNU make to compile. In my port's Makefile I have set:
Code:
USES= zip dos2unix gmake
However, when GNU make is executed, it appears to be reading Makefile and not GNUmakefile. From gmake(8)'s man page:
If no -f option is present, make will look for the makefiles GNUmakefile, makefile, and Makefile, in that order.
When I execute GNU make manually, it uses GNUmakefile as I would expect. How can I make this happen in my port? I looked through the porter's handbook and dug through the files in /usr/ports/Mk but couldn't work out what I need to tweak.

Setting default options according to architecture
My intention was for the port's default options to depending on the build architecture (the ARCH variable). Is this considered bad practice? portlint(1) complains that I am setting default options after including bsd.port.pre.mk. However, my makefile generates "malformed conditional" errors if I attempt to test ARCH before including the file.

Option dependent changes to files
I have a couple of files that need changes depending on the configuration options chosen. These are simple changes and I intend to achieve them by using ${REINPLACE_CMD} rather than trying to conditionally apply patches. I am currently running the replace in the post-configure target. I originally tried checking the chosen options in this target too, but received ".if" related errors. Moving them into the body of the makefile after including bsd.port.pre.mk appears to work. Where is the correct place to check for chosen options? I am already using the port infrastructure's capability to set RUN_DEPENDS based on chosen options without my having to script anything.

Archives within archives -- portlint warning about tar(1)
The distribution file for the port is a zip archive containing further zip archives and a tarball. At present, I am dealing with the further archives and tarball in the post-extract target. One of the commands calls tar(1). I could not find an alternative for the command in bsd.commands.mk, but portlint warns about it. Is there a better alternative?
 
Re: gmake reading Makefile, not GNUmakefile and other questi

At far as the default name of the makefile that is looked for when building a port, it is controlled by the MAKEFILE variable regardless of which flavor of make is used (see bsd.port.mk) and defaults to "Makefile".
 
Re: gmake reading Makefile, not GNUmakefile and other questi

Thanks very much, @ljboiler, I guess I have been staring at the screen too long. One step closer to having this port finished.
 
Last edited by a moderator:
Re: gmake reading Makefile, not GNUmakefile and other questi

Regarding my outstanding questions, for anyone stumbling upon this thread at a later date:
Setting default options according to architecture
I concluded that changing default port options depending on the architecture of the build machine wasn't a good idea, since for package repositories, the build architecture may not match the deployment architecture anyway (I'm really thinking about compiling packages for i386 on an amd64 machine here). I chose the most sensible set of default options according to what I expect the most likely architecture to be; options were configurable after installation anyway.

Option dependent changes to files
I continued to struggle with getting the .if construct to work properly and resorted to using the shell test function (see the man page for sh(1)) with the "test" syntax rather than square brackets.

Archives within archives -- portlint warning about tar(1)
I submitted a change request to include tar in /usr/ports/Mk/bsd.commands.mk. See bug report 192015.
 
Back
Top