elyashiv
elyashiv

Reputation: 3691

piping with make dosen't work

I'm quite new to make, and I tried to create a phony target to print targets:

.PHONY: help
help:
        $(MAKE) --print-data-base --question | \
        $(AWK) '/^[^.%][-A-Za-z0-9_]*:/ { print substr($$1, 1, length($$1)-1) }' | \
        $(SORT) | \
        $(PR) --omit-pagination --width=80 --columns=4

the code is taken from here (page 20).

when I run make help I get the following:

make --print-data-base --question | \
     '/^[^.%][-A-Za-z0-9_]*:/ { print substr($1, 1, length($1)-1) }' | \
     | \
     --omit-pagination --width=80 --columns=4
/bin/sh: 3: Syntax error: "|" unexpected
make: *** [help] Error 2

what's wrong and how can I fix it?

I'm working on linux mint, make 3.81 built for i686-pc-linux-gnu.

Upvotes: 1

Views: 67

Answers (1)

Dan Moulding
Dan Moulding

Reputation: 220623

It looks like $(AWK), $(SORT), and $(PR) are all expanding to the empty string, which means no such variables are defined in your makefile.

Upvotes: 1

Related Questions