5 ms·
$ make -pqrf <(curl https://gist.githubusercontent.com/jgrahamc/2cc6df7fd5cd61c4d93f/raw/parallel) | grep '^[^ ]*:' | cut -d : -f 1 par-% par-22 par
by Hello71 12y ago
$ make -pqrf <(curl https://gist.githubusercontent.com/jgrahamc/2cc6df7fd5cd61c4d93f/raw/parallel) | grep '^[^ ]*:' | cut -d : -f 1
par-%
par-22
par-30
par-5
par-27
par-31
all
FORCE
/proc/self/fd/13
par-13
par-9
par-23
par-19
.SUFFIXES
par-15
par-7
parallel
par-29
par-28
.parallel
par-4
par-25
par-6
par-14
.DEFAULT
par-24
par-0
par
par-1
par-10
par-16
par-2
par-11
par-17
par-20
par-8
par-21
par-12
par-26
par-18
par-3
- TheDong 12y agoRight, you used 'make' as the parser. He said "grep the makefile". You're not grepping the makefile. Nice solution though!
- Hello71 12y ago> You need to write a full parser to discover all the targets. I don't think grep '^[^ ]*:' really counts as writing a parser.
- TheDong 12y agoRunning "make -p" is running a full parser which someone else wrote. Grep is not extracting the targets from a makefile there, it's extracting the targets from an intermediate representation of a makefile.
- Hello71 12y ago> The real insanity with make is that it has no interface to check whether a Makefile contains a given target. > > Best you can do is to run make -n target to probe, but it's possible to write Makefiles that run code even though -n is used, which will defeat such probes at distribution scale. It quickly becomes an exercise in heuristics and output parsing.
- TheDong 12y agoWe're arguing different things. The comment I replied to, chaosfactors, specifically specified grepping the makefile. You're arguing that you can find all the targets and I never said you can't. I simply said you can't find them all by only grepping the makefile.