4

Does a utility exist to convert a GNU Makefile for gmake to a Makefile that can be used for make (FreeBSD-make)?

Jens
  • 69,818
  • 15
  • 125
  • 179
nickb
  • 9,140
  • 11
  • 39
  • 48
  • Have you seen this: http://stackoverflow.com/questions/1194957/what-is-the-difference-between-gmake-and-make ? – pmod Dec 13 '11 at 05:19
  • @pmod, no I had not seen that prior to my post. Interesting read, unfortunately - it still doesn't answer my question. – nickb Dec 13 '11 at 14:19
  • what sort of incompatibilities do you expect when you will use makefile written for gmake from freebsd-make? have you tried to use makefiles? i.e. could you elaborate your Question – pmod Dec 13 '11 at 15:03
  • I'm trying to build luajit.org on FreeBSD and it appears the makefile was built using gmake. I'm of the FreeBSD philosophy to not have any GPL code on my server. LuaJIT is licensed under MIT but requires gmake to build it. As such, I'd like to easily convert the LuaJIT makefile to freebsd-make so that I can build it on my server. – nickb Dec 13 '11 at 15:10
  • What does this mean "requires gmake to build it"? What happens if you are you are using make to build it? – pmod Dec 13 '11 at 15:14
  • It errors out when I run freebsd-make on luajit. **"Makefile", line 29: Need an operator Error expanding embedded variable**. When I open the Makefile for LuaJIT, it even says it needs to use Gmake. – nickb Dec 13 '11 at 15:20
  • I think you won't find any converters, you'll have to build LuaJIT with gmake if it only supports gmake. Actually it was a surprise for me that they are different. Can you use gmake port to Free BSD, for example http://www.freebsd.org/cgi/cvsweb.cgi/ports/devel/gmake/? – pmod Dec 13 '11 at 15:42
  • @pmod, yes - gmake on FreeBSD works, but then again - that defeats the entire philosophy of FreeBSD of not having GPL code on your server. – nickb Dec 13 '11 at 17:21
  • It would probably be simpler to modify the BSD make to add the features present in GNU make used by the LuaJIT GNU makefile than to write a program to convert the GNU makefile into a BSD makefile. This needn't add any GPL code to your FreeBSD server; you just add the requisite functionality from the specs without looking at the code. – Jonathan Leffler Dec 14 '11 at 07:33

3 Answers3

4

That utility is called a developer (programmer, make guru, ...) :-) Seriously, the AI required for this task is complex enough and the demand for automatic conversion sufficiently close to epsilon that nobody would seriously consider programming one.

If you have a GNU makefile it is best to use GNU make.

Jens
  • 69,818
  • 15
  • 125
  • 179
2

As already noted there are no such converter and I very doubt there could exist such. As I understand you have two options:

  1. Use GNU make port to FreeBSD. For example this.

  2. Patch makefiles to make them compatible with FreeBSD make. Actually there are not too much of them in LuaJIT (main Makefile and src/Makefile). This should be rather easy. Just make sure you have all tools (check what is called in shell), and fix "error"s step by step.

    For example, error on line 29 (export PREFIX= /usr/local) is due to GNU make directive export which has no similar in FreeBSD make. The manual says "Environment variables are set outside the Makefile in the shell that is running make" and thus you have to comply with this requirement.

    Also you'll need to fix all make conditionals and etc, the whole bunch of differences is collected in BSD make vs. GNU make

Community
  • 1
  • 1
pmod
  • 10,450
  • 1
  • 37
  • 50
1

It is unlikely that there is one because there are things you can do in GNU make that you can't do in other versions of make. Amongst others, the function macros for manipulating strings and the conditionals in the makefile are generally not available.

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278