abakh / nbsdgames

A package of 18 text-based modern games
Other
208 stars 16 forks source link

Errors in Makefile conditionals #7

Closed eliasrg closed 3 years ago

eliasrg commented 3 years ago

When trying to build the package on Arch Linux, I got an error:

Makefile:2: *** invalid syntax in conditional.  Stop.

On line 2 in Makefile there is the line ifndef $(CFLAGS). I think this should be ifndef CFLAGS. As explained in the make manual, ifdef and ifndef take a variable name, not a reference. In this case, if CFLAGS is empty, the line would expand to just ifndef, a syntax error.

abakh commented 3 years ago

Fixed, thank you for reporting. (It somehow worked on my system.)

There is a huge amount of redundancy in the Makefile, and I'm not good in Unix DSLs, commits to improve it are welcome.

eliasrg commented 3 years ago

I am not an expert on make, but I would probably recommend to remove the ifndefs entirely. Just write CFLAGS=... directly. They can still be overridden if necessary, by calling make CFLAGS=.... As it is now, if CFLAGS is in the environment (as it is in Arch's build scripts), this value will be used.

Or maybe it would be even better to do CFLAGS += .... I am not quite sure what would be best.

abakh commented 3 years ago

ifndefs removed