rmyorston / pdpmake

Public domain POSIX make
https://frippery.org/make
Other
107 stars 11 forks source link

Escaped comments cause error #38

Open emmatebibyte opened 7 months ago

emmatebibyte commented 7 months ago
$ pdpmake
sh: 1: Syntax error: Unterminated quoted string
pdpmake: nothing to be done for all

The line in question: SYSEXITS!=printf '\#include <sysexits.h>\n' cpp -M || include/sysexits.h

rmyorston commented 7 months ago

POSIX doesn't allow any exception to the rule that # on a line starts a comment which extends to the next unescaped newline.

pdpmake has extensions such that # doesn't introduce a comment in macro expansions and commands. It doesn't allow # to be escaped with a backslash.

Perhaps it should.

In the meantime the following should work: SYSEXITS!=printf '\043include <sysexits.h>\n' cpp -M || include/sysexits.h

rmyorston commented 6 months ago

I've added a non-POSIX extension to allow # to be escaped with a preceding backslash.

This is based on my reading of the GNU make documentation, but since I'm not in the habit of escaping #s I may have misinterpreted it.

Please test and let me know if it works for you.

emmatebibyte commented 6 months ago

I was actually hoping to stick to more POSIX-y stuff, I hadn’t realized the escaped hash wasn’t POSIX.