Skip to content

patsubst doesn't work #98

Description

@hb--
$ mmk/id
%MMK-I-IDENT, this is the MMK Make Utility V5.1
-MMK-I-COPYRIGHT, Copyright (c) 2008, Matthew Madison.
    Copyright (c) 2014, Endless Software Solutions.
  See LICENSE.TXT in distribution kit for license information.
$ type descrip.mms
ARCH=$(patsubst %1.0,%,$(VERSION))
TMPSRC=$(subst V,RELEASE,$(ARCH))
.if $(ARCH) .eq $(TMPSRC)
TMPSRC=$(subst T,TEST,$(ARCH))
.endif
all :
        @ write sys$output "VERSION: $(VERSION), ARCH: $(ARCH), TMPSRC: $(TMPSRC
)"
$ mmk/ext /macr=VERSION=V1.0
VERSION: V1.0, ARCH: , TMPSRC: 
$ 

Expected output:

$ mms/id 
%MMS-I-IDENT, MMS V4.0 � Copyright 2015 VMS Software, Inc and Hewlett-Packard De
velopment Company, L.P.
$ mms/ext /macr=VERSION=V1.0

VERSION: V1.0, ARCH: V, TMPSRC: RELEASE
$ 

and with GNU Make

# make -v
GNU Make 4.1
Built for i686-pc-linux-gnu
...
# cat Makefile
TYPE=$(patsubst %1.0,%,$(VERSION))
TMPSRC=$(subst V,RELEASE,$(TYPE))
ifeq ($(TYPE),$(TMPSRC))
TMPSRC=$(subst T,TEST,$(TYPE))
endif
all :
        @ echo "VERSION: $(VERSION), TYPE: $(TYPE), TMPSRC: $(TMPSRC)"
# make VERSION=V1.0
VERSION: V1.0, TYPE: V, TMPSRC: RELEASE
#

Probably related:

$ type descrip.mms
all :
        @ write sys$output "$(patsubst %.c,%.o,a.c b.c foobar.c c.x.c)"
$ mmk/ext
a.o b.o f o a . c. .
$ 

Expected output:

# cat Makefile 
all :
        @ echo "$(patsubst %.c,%.o,a.c b.c foobar.c c.x.c)"
# make
a.o b.o foobar.o c.x.o
# 

Probably unrelated:

$ type descrip.mms
all :
        @ write sys$output "$(patsubst %.c,%.o,a.c b.c foobar.c c.x.c,)"
$ mmk/ext
%MMK-W-TOOMANYARGS, too many function parameters for 'PATSUBST'

$ 

Expected output:

# cat Makefile 
all :
        @ echo "$(patsubst %.c,%.o,a.c b.c foobar.c c.x.c,)"
# make
a.o b.o foobar.o c.x.c,
# 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions