rmyorston / pdpmake

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

Unable to process the makefile generated by GNU Autotools #44

Closed ghost closed 4 months ago

ghost commented 4 months ago

The project I'm testing: http://fox-toolkit.org/ftp/fox-snapshot.zip

The error message:

$ make
Making all in utils
make: (makefile:131): recursive macro am__v_lt_
make: (makefile:521): failed to build 'all-recursive' exit 1
rmyorston commented 4 months ago

A minimal makefile to reproduce the issue is:

FLAG_ = $(FLAG_$(VALUE))
FLAG_0 = flag 0
FLAG_1 = flag 1
MYFLAG = $(FLAG_$(VALUE))
VALUE = 1

target:
    @echo $(MYFLAG)

This is a regression introduced by commit 9f775fc5b6dd5a15f2a3336772b813bdfe3ead12 to fix issue #31. It resulted in lines that might be target rules having macros expanded. Doing this for the line setting MYFLAG results in recursion because VALUE hasn't been defined yet.

I've reverted the previous attempt to fix #31 and have used a different approach.

ghost commented 4 months ago

Updated to the latest code and it still fails to process the makefile generated by GNU Autotools (this time with another error):

$ make
Making all in utils
g++ -DPACKAGE_NAME=\"fox\" -DPACKAGE_TARNAME=\"fox\" -DPACKAGE_VERSION=\"1.7.85\" -DPACKAGE_STRING=\"fox\ 1.7.85\" -DPACKAGE_BUGREPORT=\"jeroen@fox-toolkit.net\" -DPACKAGE_URL=\"\" -DPACKAGE=\"fox\" -DVERSION=\"1.7.85\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DLT_OBJDIR=\".libs/\" -D__EXTENSIONS__=1 -D_ALL_SOURCE=1 -D_GNU_SOURCE=1 -D_POSIX_PTHREAD_SEMANTICS=1 -D_TANDEM_SOURCE=1 -DX_DISPLAY_MISSING=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_DIRENT_H=1 -DHAVE_LIBPTHREAD=1 -DHAVE_PTHREAD_GETNAME_NP=1 -DHAVE_PTHREAD_SETNAME_NP=1 -DHAVE_SEMAPHORE_H=1 -DHAVE_IMMINTRIN_H=1 -DHAVE_ZLIB_H=1 -I.    -I/usr/include/freetype2  -Wall -Wextra -Woverloaded-virtual -Wshadow -Wstrict-overflow -Wstrict-aliasing -Wdouble-promotion -Wno-implicit-fallthrough -DHAVE_ZLIB_H=1 -DNO_XIM -DHAVE_GL_H=1 -DHAVE_GLU_H=1 -MT reswrap.o -MD -MP -MF .deps/reswrap.Tpo -c -o reswrap.o reswrap.cpp
mv -f .deps/reswrap.Tpo .deps/reswrap.Po
/bin/sh ../libtool  --tag=CXX    --mode=link g++   -Wall -Wextra -Woverloaded-virtual -Wshadow -Wstrict-overflow -Wstrict-aliasing -Wdouble-promotion -Wno-implicit-fallthrough -DHAVE_ZLIB_H=1 -DNO_XIM -DHAVE_GL_H=1 -DHAVE_GLU_H=1   -o reswrap.exe reswrap.o
libtool: link: g++ -Wall -Wextra -Woverloaded-virtual -Wshadow -Wstrict-overflow -Wstrict-aliasing -Wdouble-promotion -Wno-implicit-fallthrough -DHAVE_ZLIB_H=1 -DNO_XIM -DHAVE_GL_H=1 -DHAVE_GLU_H=1 -o .libs/reswrap.exe reswrap.o
Making all in include
make: nothing to be done for all
Making all in lib
make: (makefile:518): expected separator
make: (makefile:521): failed to build 'all-recursive' exit 1
rmyorston commented 4 months ago

Works for me on Fedora Linux.

What do you have at around line 518 of the makefile for lib?

ghost commented 4 months ago

Works for me on Fedora Linux.

What do you have at around line 518 of the makefile for lib?

This is from line 489 to line 521:

# This directory's subdirectories are mostly independent; you can cd
# into them and run 'make' without going through this Makefile.
# To change the values of 'make' variables: instead of editing Makefiles,
# (1) if the variable is set in 'config.status', edit 'config.status'
#     (which will cause the Makefiles to be regenerated when you run 'make');
# (2) otherwise, pass the desired values on the 'make' command line.
$(am__recursive_targets):
    @fail=; \
    if $(am__make_keepgoing); then \
      failcom='fail=yes'; \
    else \
      failcom='exit 1'; \
    fi; \
    dot_seen=no; \
    target=`echo $@ | sed s/-recursive//`; \
    case "$@" in \
      distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
      *) list='$(SUBDIRS)' ;; \
    esac; \
    for subdir in $$list; do \
      echo "Making $$target in $$subdir"; \
      if test "$$subdir" = "."; then \
        dot_seen=yes; \
        local_target="$$target-am"; \
      else \
        local_target="$$target"; \
      fi; \
      ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
      || eval $$failcom; \
    done; \
    if test "$$dot_seen" = "no"; then \
      $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
    fi; test -z "$$fail"
rmyorston commented 4 months ago

That looks like the top-level Makefile. I was asking about the one in the lib directory.

ghost commented 4 months ago

That looks like the top-level Makefile. I was asking about the one in the lib directory.

Line 469 to line 518 in lib/Makefile:

CURSORS = \
$(top_srcdir)/lib/blank.xbm \
$(top_srcdir)/lib/blank_mask.xbm \
$(top_srcdir)/lib/crosshair.xbm \
$(top_srcdir)/lib/crosshair_mask.xbm \
$(top_srcdir)/lib/dndask.xbm \
$(top_srcdir)/lib/dndask_mask.xbm \
$(top_srcdir)/lib/dndcopy.xbm \
$(top_srcdir)/lib/dndcopy_mask.xbm \
$(top_srcdir)/lib/dndlink.xbm \
$(top_srcdir)/lib/dndlink_mask.xbm \
$(top_srcdir)/lib/dndmove.xbm \
$(top_srcdir)/lib/dndmove_mask.xbm \
$(top_srcdir)/lib/dontdrop.xbm \
$(top_srcdir)/lib/dontdrop_mask.xbm \
$(top_srcdir)/lib/drag.xbm \
$(top_srcdir)/lib/drag_mask.xbm \
$(top_srcdir)/lib/gray.xbm \
$(top_srcdir)/lib/hand.xbm \
$(top_srcdir)/lib/hand_mask.xbm \
$(top_srcdir)/lib/helparrow.xbm \
$(top_srcdir)/lib/helparrow_mask.xbm \
$(top_srcdir)/lib/hsplit.xbm \
$(top_srcdir)/lib/hsplit_mask.xbm \
$(top_srcdir)/lib/move.xbm \
$(top_srcdir)/lib/move_mask.xbm \
$(top_srcdir)/lib/ne.xbm \
$(top_srcdir)/lib/ne_mask.xbm \
$(top_srcdir)/lib/se.xbm \
$(top_srcdir)/lib/se_mask.xbm \
$(top_srcdir)/lib/sw.xbm \
$(top_srcdir)/lib/sw_mask.xbm \
$(top_srcdir)/lib/nw.xbm \
$(top_srcdir)/lib/nw_mask.xbm \
$(top_srcdir)/lib/resizeleft.xbm \
$(top_srcdir)/lib/resizeleft_mask.xbm \
$(top_srcdir)/lib/resizetop.xbm \
$(top_srcdir)/lib/resizetop_mask.xbm \
$(top_srcdir)/lib/resizetopleft.xbm \
$(top_srcdir)/lib/resizetopleft_mask.xbm \
$(top_srcdir)/lib/resizetopright.xbm \
$(top_srcdir)/lib/resizetopright_mask.xbm \
$(top_srcdir)/lib/rotate.xbm \
$(top_srcdir)/lib/rotate_mask.xbm \
$(top_srcdir)/lib/swatch.xbm \
$(top_srcdir)/lib/swatch_mask.xbm \
$(top_srcdir)/lib/vsplit.xbm \
$(top_srcdir)/lib/vsplit_mask.xbm \
$(top_srcdir)/lib/xsplit.xbm \
$(top_srcdir)/lib/xsplit_mask.xbm
rmyorston commented 4 months ago

That's the same as I get on Linux and it works there. An unexpected separator error suggests the macro assignment hasn't been processed successfully. I'm not sure why that would happen.

rmyorston commented 4 months ago

I've found the problem. The CURSORS macro assignment was being split into two parts due to lack of space in the line buffer. The latest pdpmake source built using MSYS2 now works for that Makefile.