[dev] Special target ".POSIX" in Makefiles

2021-12-30 Thread craekz7
Hi, I'm wondering why the Makefiles of some suckless programs (and libs) have the special target `.POSIX` in them and some don't. For example, dwm doesn't have it in it's Makefile but there isn't a single non-POSIX feature used. I think it would be better to include the `.POSIX` target simply to

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-30 Thread Mattias Andrée
I agree that it shall be added to all Makefile, because “otherwise, the behavior of make is unspecified.” (Quote from the POSIX specifications) Probably missing because people don't usually learn make(1) by reading the entire manual. .POSIX can be used as long a the makefile does not use any feat

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-30 Thread craekz7
>I agree that it shall be added to all Makefile, because >otherwise the behavior of make is unspecified. >(Quote from the POSIX specifications) I'm sure you meant it like that, but just to clarify it: It is only unspecified if it doesn't appear as the first non-comment line, has prerequisites or co

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-30 Thread Laslo Hunhold
On Thu, 30 Dec 2021 17:49:23 +0100 crae...@gmail.com wrote: Dear craekz, > As far as I can see, we could add `.POSIX` to the following programs: > dwm, dmenu, dwmstatus, sent and tabbed > I've just looked over the Makefiles very briefly, so I may have > overseen something. Note: I just picked out

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-30 Thread Mattias Andrée
On Thu, 30 Dec 2021 21:07:06 +0100 Laslo Hunhold wrote: > On Thu, 30 Dec 2021 17:49:23 +0100 > crae...@gmail.com wrote: > > Dear craekz, > > > As far as I can see, we could add `.POSIX` to the following programs: > > dwm, dmenu, dwmstatus, sent and tabbed > > I've just looked over the Makefiles

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-30 Thread Laslo Hunhold
On Thu, 30 Dec 2021 21:17:32 +0100 Mattias Andrée wrote: Dear Mattias, > I've actually being thinking of writing a makefile linter. > How interested would people be in such a tool? very interested! Even though, when you implement the logic, you might as well go all the way and offer a make(1) t

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-30 Thread Mattias Andrée
On Thu, 30 Dec 2021 23:07:35 +0100 Laslo Hunhold wrote: > On Thu, 30 Dec 2021 21:17:32 +0100 > Mattias Andrée wrote: > > Dear Mattias, > > > I've actually being thinking of writing a makefile linter. > > How interested would people be in such a tool? > > very interested! Even though, when y

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-30 Thread NRK
On Thu, Dec 30, 2021 at 09:17:32PM +0100, Mattias Andrée wrote: > I've actually being thinking of writing a makefile linter. > How interested would people be in such a tool? > > The reason to have a linter separate from a make utility itself > is that it would not have to reject non-standard featu

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-30 Thread NRK
On Fri, Dec 31, 2021 at 12:49:46PM +0600, NRK wrote: > What would be a posix replacement for `?=` ? I assume something like: > > VAR = $$(if test -n "$$VAR"; then printf "%s" "$$VAR"; else printf > "fallback"; fi) > Now that I think about it, posix shell has parameter expansion that could

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-31 Thread Laslo Hunhold
On Fri, 31 Dec 2021 12:49:46 +0600 NRK wrote: Dear NRK, > Hmm, I was under the impression that `?=` was accepted into POSIX. > But I cannot find any mention of it in the posix manpage (man 1p > make) so I guess I was wrong. > > What would be a posix replacement for `?=` ? I assume something lik

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-31 Thread Arthur Williams
I too fell victim to the GNU trap and thought "?=" was standard and actually useful. > and want to "dynamically" override it (e.g. in a build system context) > when the environment already specifies PREFIX, you either do > >make -e Completely forgot about the -e flag. Now I need to go update

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-31 Thread Hiltjo Posthuma
On Fri, Dec 31, 2021 at 01:52:42AM -0800, Arthur Williams wrote: > I too fell victim to the GNU trap and thought "?=" was standard and > actually useful. > > > and want to "dynamically" override it (e.g. in a build system context) > > when the environment already specifies PREFIX, you either do >

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-31 Thread Laslo Hunhold
On Fri, 31 Dec 2021 01:52:42 -0800 Arthur Williams wrote: Dear Arthur, > I too fell victim to the GNU trap and thought "?=" was standard and > actually useful. hehe this thread here feels like a self-help-thread of the newly POSIX-make-awakened! > Completely forgot about the -e flag. Now I nee

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-31 Thread Laslo Hunhold
On Fri, 31 Dec 2021 11:16:18 +0100 Hiltjo Posthuma wrote: Dear Hiltjo, > In my opinion a practical way is to really test it on different > systems (bleeding edge Linux, older Debian stable, NetBSD, OpenBSD) > and GNU/Make, different BSD make programs. > > This doesn't cover the POSIX compatibil

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-31 Thread Hiltjo Posthuma
On Fri, Dec 31, 2021 at 11:33:21AM +0100, Laslo Hunhold wrote: > On Fri, 31 Dec 2021 11:16:18 +0100 > Hiltjo Posthuma wrote: > > Dear Hiltjo, > > > In my opinion a practical way is to really test it on different > > systems (bleeding edge Linux, older Debian stable, NetBSD, OpenBSD) > > and GNU/

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-31 Thread craekz7
> Yeah you make a strong argument. I too think a linting tool would be > useful. I imagine it would function like shellcheck does for shells. If > nothing else it would really help people identify GNU extensions vs > portable behavior. Something like shellcheck would be awesome! Given that the POSI

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-31 Thread Mattias Andrée
On Fri, 31 Dec 2021 12:53:59 +0100 crae...@gmail.com wrote: > > Yeah you make a strong argument. I too think a linting tool would be > > useful. I imagine it would function like shellcheck does for shells. If > > nothing else it would really help people identify GNU extensions vs > > portable beha

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-31 Thread Michael Forney
On 2021-12-30, NRK wrote: > Hmm, I was under the impression that `?=` was accepted into POSIX. But I > cannot find any mention of it in the posix manpage (man 1p make) so I > guess I was wrong. It is accepted for the upcoming POSIX issue 8: https://austingroupbugs.net/view.php?id=330

Re: [dev] Special target ".POSIX" in Makefiles

2021-12-31 Thread Mattias Andrée
I just started implementing a linter[0]. Even though I just started it today, I think that's enough for this year. Happy New Year! Mattias Andrée [0] https://github.com/maandree/makelint/ On Thu, 30 Dec 2021 21:17:32 +0100 Mattias Andrée wrote: > On Thu, 30 Dec 2021 21:07:06 +0100 > Laslo Hun

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread NRK
On Fri, Dec 31, 2021 at 11:29:11PM +0100, Mattias Andrée wrote: > I just started implementing a linter[0]. Even though I just > started it today, I think that's enough for this year. > > Happy New Year! > Mattias Andrée > > [0] https://github.com/maandree/makelint/ Thank you very much, I'll keep

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread Mattias Andrée
Thanks for pointing that it, I didn't find it in my search. I renamed it to mklint. Regards, Mattias Andrée On Sat, 1 Jan 2022 14:43:15 +0600 NRK wrote: > On Fri, Dec 31, 2021 at 11:29:11PM +0100, Mattias Andrée wrote: > > I just started implementing a linter[0]. Even though I just > > starte

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread Laslo Hunhold
On Sat, 1 Jan 2022 10:33:22 +0100 Mattias Andrée wrote: Dear Mattias, first off, happy new year to all of you! > Thanks for pointing that it, I didn't find it in my search. > I renamed it to mklint. This is also confusing as mk(1) by plan9 exists, but you explicitly target POSIX make(1). make

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread Lincoln Auster
> I'd definitely be interested in such a tool. Weather it be in form of > a make implementation or linter doesn't matter a whole lot to me as > long as the end goal of having a tool to help write portable makefile > is achieved. This is my take, too --- I'd get plenty of use out of either version,

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread Mattias Andrée
On Sat, 1 Jan 2022 13:01:05 +0100 Laslo Hunhold wrote: > On Sat, 1 Jan 2022 10:33:22 +0100 > Mattias Andrée wrote: > > Dear Mattias, > > first off, happy new year to all of you! > > > Thanks for pointing that it, I didn't find it in my search. > > I renamed it to mklint. > > This is also c

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread Laslo Hunhold
On Sat, 1 Jan 2022 13:22:48 +0100 Mattias Andrée wrote: Dear Mattias, > libzahl is my only project with a German name, and it's was called > libzahl because the bold Z used represent the integers stands for > Zahl, but I do have projects with names in different languages (I > also have libskrift

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread Ralph Eastwood
Hi Mattias, Happy New Year! > But I also like makel, but I will give it some more though before I rename it a second time. So... makellint? :D I like it; it seems 'makel' is unused as a project name. Are there any suggestions for handling out-of-source builds using POSIX makefiles? I recently

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread Laslo Hunhold
On Sat, 1 Jan 2022 14:08:24 +0100 Ralph Eastwood wrote: Dear Ralph, > So... makellint? :D > I like it; it seems 'makel' is unused as a project name. and even if, it's not like names are reserved. When some 13-year-old kid dumps some Rust-crap with a name on GitHub I wouldn't see it as reserved.

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread Ralph Eastwood
Hi Laslo, > and then in config.mk have a variable > >TARGET = arm > > and then in the Makefile have a line > >include target/$TARGET.mk Thanks for pointing out that technique, I've utilised it in the past and it's a shame that it's not more well-known... I've seen many a GNUism in its pla

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread Laslo Hunhold
On Sat, 1 Jan 2022 17:03:41 +0100 Ralph Eastwood wrote: Dear Ralph, > Thanks for pointing out that technique, I've utilised it in the past > and it's a shame that it's not more well-known... I've seen many a > GNUism in its place... yeah, it makes a lot of sense and is nice and simple. > The i

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread Mattias Andrée
.POSIX: CC = c99 # Required as POSIX doesn't mandate that it is defined by default OBJ =\ alpha.o\ beta.o\ gamma.o LINUX_AMD64_OBJ = $(OBJ:.o=.linux-amd64-o) OPENBSD_AMD64_OBJ = $(OBJ:.o=.openbsd-amd64-o) all: myproj-linux-amd64 myproj-openbsd-amd64 myproj-linux-amd64:

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread Ralph Eastwood
Hi Laslo and Mattias, On Sat, 1 Jan 2022 at 19:05, Laslo Hunhold wrote: > If you think about it, a better approach in this case would be to pack > these things into a static library (which is basically a collection of > object files). So you would have a target On Sat, 1 Jan 2022 at 20:10, Matti

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-01 Thread Laslo Hunhold
On Sat, 1 Jan 2022 23:30:39 +0100 Ralph Eastwood wrote: Dear Ralph, > Those are both useful suggestions! Thank you! you're very welcome! :) With best regards Laslo

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-03 Thread Markus Wichmann
On Sat, Jan 01, 2022 at 08:09:38PM +0100, Mattias Andrée wrote: > .POSIX: > > CC = c99 > # Required as POSIX doesn't mandate that it is defined by default > > OBJ =\ > alpha.o\ > beta.o\ > gamma.o > > LINUX_AMD64_OBJ = $(OBJ:.o=.linux-amd64-o) > OPENBSD_AMD64_OBJ = $(OBJ:.o=.openb

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-03 Thread Mattias Andrée
On Mon, 3 Jan 2022 11:16:48 +0100 Markus Wichmann wrote: > On Sat, Jan 01, 2022 at 08:09:38PM +0100, Mattias Andrée wrote: > > .POSIX: > > > > CC = c99 > > # Required as POSIX doesn't mandate that it is defined by default > > > > OBJ =\ > > alpha.o\ > > beta.o\ > > gamma.o > > > > LIN

Re: [dev] Special target ".POSIX" in Makefiles

2022-01-03 Thread Ismael Luceno
El vie, 31 dic 2021 a la(s) 09:30, Laslo Hunhold (d...@frign.de) escribió: > > On Fri, 31 Dec 2021 12:49:46 +0600 > NRK wrote: > > Dear NRK, > > > Hmm, I was under the impression that `?=` was accepted into POSIX. > > But I cannot find any mention of it in the posix manpage (man 1p > > make) so I