[misc] calcurse and GNUmake requirement for it's Makefiles

Hi,

While I tried to complile calcurse git 7b81e69 on OpenBSD, the
build failed with:

Making all in test
Making all in scripts
"calcurse-upgrade"
Configuration file not found:
/calcurse-4.3.0.0.20190204.git.7b81e69_writes_to_HOME/.calcurse/conf
*** Error 1 in scripts (Makefile:505 'calcurse-upgrade')
*** Error 1 in . (Makefile:412 'all-recursive')

Current calcurse port on OpenBSD doesn't use GNU make, but it's own make
implementation, included in the base system.

Part of the Makefile where it fails is defined from Makefile.am, as
follows:

$ cat -n scripts/Makefile.am
     1  AUTOMAKE_OPTIONS = foreign
     2  
     3  dist_bin_SCRIPTS = \
     4          calcurse-upgrade
     5  
     6  EXTRA_DIST = \
     7          calcurse-upgrade.sh.in
     8  
     9  CLEANFILES = \
    10          calcurse-upgrade
    11  
    12  edit = sed \
    13          -e 's|@PACKAGE_VERSION[@]|$(PACKAGE_VERSION)|g'
    14  
    15  calcurse-upgrade: calcurse-upgrade.sh.in
    16          $(AM_V_at)$(RM) "$@"
    17          $(AM_V_GEN)$(edit) <"$(srcdir)/$<" >"$@"
    18          $(AM_V_at)chmod +x "$@"
    19          $(AM_V_at)chmod a-w "$@"


It's the line 16 above which fails, where $(RM) variable is empty and
"$@" is executed instead, which is defined as `calcurse-upgrade`.

Under OpenBSD ports framework $HOME for the port is defined to:

	/calcurse-4.3.0.0.20190204.git.7b81e69_writes_to_HOME/

hence above error message, with strange location of the config file.
When I switch calcurse to use GNUmake, the problem is gone and RM
variable is automatically defined (not in the Makefile, but inside the
gmake(1) program itself, not sure where is comes from).

However to keep dependency chain to minimum and avoid dependency on
gmake, I came up with following patch to configure.ac to detect rm(1)
program during ./configure and get it defined inside generated Makefile:


Index: configure.ac
--- configure.ac.orig
+++ configure.ac
@@ -19,6 +19,7 @@ AC_CANONICAL_HOST
 #                                                            Checks for programs
 #-------------------------------------------------------------------------------
 AC_PROG_CC
+AC_CHECK_PROG(RM, rm, [rm -f])
 #-------------------------------------------------------------------------------
 #                                                        Checks for header files
 #-------------------------------------------------------------------------------

That's how the Makefile ends up, before and after:

$ grep -F 'RM =' scripts/Makefile | wc -l
       0

$ grep -F 'RM =' scripts/Makefile
RM = rm -f

With RM variable defined build moves forward with BSD make, but fails a
little further with:

Making all in test
Making all in scripts
rm -f "calcurse-upgrade"
Using $< in a non-suffix rule context is a GNUmake idiom (Makefile:507)
*** Error 1 in . (Makefile:413 'all-recursive')

So, it seems that some Makefiles inside calcurse source code use GNU
make specific idioms. Now, finally to my question. Could you update
documentation (specifically the README.md file) that GNU make is
actually a requirement to compile calcurse, or do you think you
could use more portable way of writing them? Whatever you chose
I would just like to see this more explicit in the docs.

I tried to fix above Makefile, but it fails again later in another
Makefile, so it's not one instance of the problem. I stopped there
and enabled GNU make support in the port.

Please CC me with any replies, as I have email delivery for the mailing
list disabled. Thanks.

-- 
Regards,
 Mikolaj

Links