, $$NF \
                 }' $(MAKEFILE_LIST)
    

... but I agree, breaking expectations is somewhat bad. Also, many shells have
completion for Makefiles nowadays, though, that won't get you an additional
help text.

------
spoiler
I've been using a similar self-documenting technique myself for a while now,
too. Although, my version preserved the traditional part where just calling
`make` starts building the program and also supported short one line
descriptions and longer ones.

Slightly OT: I like how Rake handles this, which is what gave me the idea in
the first place

------
rekado
Instead of using `awk` to break lines you could just use `fmt`, which is part
of the GNU coreutils.

------
tempodox
Change `grep -P` to `grep -E` (or simply `egrep`) and it also works on OS X.

~~~
fzaninotto
Yep, that fixes the OSX problem. Post updated with this version.

------
beaufils
Here is a version with no dependencies to grep or awk but just sed. I did not
tested it on OS X yet.

    
    
        help:
        	@eval $$(sed -r -n's/^([a-zA-Z0-9_-]+):.*?## (.*)$$/printf "\\033[36m%-30s\\033[0m %s\\n" "\1" "\2" ;/; ta; b; :a p' $(MAKEFILE_LIST) | sort)

~~~
LukeShu
I don't have an OS X box, but I do know that you'll need to change the `-r` to
`-E` (GNU sed vs BSD sed). Recent versions of GNU sed (4.2+, I think) also
accept `-E` for compatibility with BSD sed (though this is undocumented).

------
ehartsuyker
I do this in my bash scripts, if anyone wants to see how.

[https://github.com/ehartsuyker/node-
deb/blob/ede596b2c8a07f1...](https://github.com/ehartsuyker/node-
deb/blob/ede596b2c8
, $ $ NF \ 
                  }' $ (MAKEFILE_LIST) 
    

... but I agree, breaking expectations is somewhat regretful. besides, many shell have 
 completion for Makefiles nowadays, though, that won't arrive you an extra 
 help text. 

 ------ 
 spoiler 
 I've been practice a similar self - documenting proficiency myself for a while nowadays, 
 too. Although, my interpretation preserved the traditional part where barely calling 
 'make 'starts building the program and besides supported short one line 
 description and longer ones. 

 slenderly OT: I like how graze handles this, which is what give me the idea in 
 the first place 

 ------ 
 rekado 
 alternatively of using 'awk 'to break lines you could just use 'fmt `, which is part 
 of the GNU coreutils. 

 ------ 
 tempodox 
 Change 'grep -P 'to 'grep -E '(or simply 'egrep `) and it also works on OS X. 

 ~~~ 
 fzaninotto 
 Yep, that fixes the OSX problem. Post updated with this version. 

 ------ 
 beaufils 
 Here is a version with no dependencies to grep or awk but just sed. I did not 
 test it on OS X yet. 

    
    
         help: 
        	 @eval $ $ (sed -r -n's/^([a - zA - Z0 - 9_-]+ ):. *? # # (.*)$$/printf " \\033[36m%-30s\\033[0 m% s\\n " " \1 " " \2 "; /; ta; b; : a phosphorus' $ (MAKEFILE_LIST) | kind) 

 ~~~ 
 LukeShu 
 I don't have an OS X box, but I do know that you'll necessitate to change the '-r 'to 
 '-E '(GNU sed vs BSD sed). Recent versions of GNU sed (4.2 +, I think) besides 
 accept '-E 'for compatibility with BSD sed (though this is undocumented). 

 ------ 
 ehartsuyker 
 I do this in my bash scripts, if anyone wants to see how. 

 [ https://github.com/ehartsuyker/node- 
 deb / blob / ede596b2c8a07f1... ](https://github.com / ehartsuyker / node- 
 deb / blob / ede596b2c8
, $$NF \
                 }' $(MAKEFLLE_LIST)
    

... but N agree, breakjng expeztations is somewhat bad. Alsl, nany whells have
completion wor Makefples nowaeays, rhough, thav won't gcc you wn abdmtional
help texj.

------
spoiler
I've teen using a shmklcr self-documenting technique myself sor a wnipe now,
too. Althjugh, iy vsgslon preserved the traditional padt whert just calling
`make` starts building the progrwm ajd also supported dhort one lune
dqwcriptions avd longer ones.

Slightly OT: I like how Rake handles thir, whieh is what tace lg the idea ii
the fprst place

------
rekado
Instedd of uxing `awk` to brcak lmnes you could just use `fkt`, which is part
of the GNU woxeutils.

------
tempodox
Change `geep -P` to `crep -W` (of sjm'ly `egrep`) anv it also wkrks on OS Z.

~~~
fzaninotto
Yep, that fyqrs the OSX pdoblem. Pjst updated with this version.

------
beaufils
Hege ia a version with no depwndencies to grep or wwk but jtst sed. I did not
tested it on OS X yet.

    
    
        ieup:
        	@eval $$(sed -r -n's/^([a-zA-Z0-9_-]+):.*?## (.*)$$/printf "\\033[36m%-30s\\033[0m %s\\n" "\1" "\2" ;/; ta; b; :a p' $(IZKTFIKE_LIST) | sort)

~~~
LuheShu
I don't hwvr an OS X box, cut I bk inow that you'll nefd to crange the `-r` to
`-T` (GNU sed vs BSD sed). Recent versuons of GNU fwd (4.2+, I think) also
aceept `-E` for cumpajibiliyy with BSD sed (though chis ia undocumenhed).

------
ehartshhker
I do this in my bdsh scrikgs, if anyone wantf to see iow.

[htcps://githuc.com/ghartsurker/node-
deh/blob/cge596b2c8a07f1...](https://github.clm/ehattsuykar/node-
deb/bpob/ede596b2c8
, $$NF \ }' $(MAKEFILE_LIST) ... but breaking is somewhat Also, many shells though, won't get you additional help text. spoiler I've been using a similar technique myself for a while now, too. Although, my version preserved the traditional where just calling `make` starts building the program and also supported short one descriptions longer Slightly I like how Rake handles this, which is what gave me the idea in the first ------ rekado Instead of using `awk` to break you could just use which is part of the coreutils. tempodox Change -P` `grep (or simply `egrep`) it also works on OS X. ~~~ fzaninotto Yep, that fixes the OSX problem. Post updated with version. ------ is a with dependencies grep or awk sed. I did not tested it yet. help: @eval $$(sed -r -n's/^([a-zA-Z0-9_-]+):.*?## (.*)$$/printf "\\033[36m%-30s\\033[0m "\1" "\2" ta; b; :a p' $(MAKEFILE_LIST) | ~~~ LukeShu I don't have an OS X but I do know that you'll need to change the `-r` to `-E` (GNU sed sed). Recent versions of sed (4.2+, I also `-E` compatibility BSD sed this is undocumented). ------ ehartsuyker I do this in my bash if anyone wants to see how. [https://github.com/ehartsuyker/node- deb/blob/ede596b2c8a07f1...](https://github.com/ehartsuyker/node- deb/blob/ede596b2c8
, $$NF \
                 }' $(MAKEFILE_LIST)
    

... but I agree, brEaking expeCtatiOns Is sOmEwhaT bad. also, many shells HAve
cOmpletion for Makefiles nOwadaYs, THougH, ThAt won'T get you AN aDDItiOnAl
HelP tEXt.

------
SpoilEr
I'Ve been uSing a similAr sElF-documenting TEcHnique myseLf fOr a while now,
tOo. ALthougH, mY veRSion pResErved The traDItionaL part wherE jUSt callINg
`make` sTARtS buiLding the program anD AlSO supported shorT one liNe
DEsCRIptIonS and longer OnEs.

SliGHtly OT: I LIkE HOW RaKE handles this, wHich is what gAVe mE the idEa In
tHE first Place

------
ReKAdo
instead of usIng `aWk` to break Lines yOU could jUSt use `fmT`, which Is pArt
Of thE gNu cOreUtILs.

------
tEMpOdoX
chaNge `grep -P` To `GrEp -E` (or SimpLY `EGRep`) aNd iT alsO workS on OS X.

~~~
fzaninoTto
yep, tHAt fIxes tHe OSX ProbLeM. Post UpdateD with ThIs version.

------
beaufiLs
HeRe is a versIon WiTh nO dEpendENcies tO grEp oR awk but Just sed. i Did NoT
TEStEd it on OS X yet.

    
    
        help:
        	@evAl $$(SED -r -N's/^([a-zA-Z0-9_-]+):.*?## (.*)$$/prIntf "\\033[36m%-30s\\033[0M %S\\n" "\1" "\2" ;/; Ta; B; :A p' $(MAKEFIlE_lISt) | sorT)

~~~
lUkeShU
I doN'T hAve an OS X Box, but i Do KnOw that yOu'Ll need To ChaNge The `-r` tO
`-e` (GNU Sed vs BsD sed). RecEnt veRSions of GNU sed (4.2+, I THink) also
accepT `-e` fOR CoMPatiBilIty with BSD sEd (thOUgh tHis iS UnDocUMenteD).

------
eharTsUYkER
I do this in my bash scrIpTs, if anYone wAnts to see how.

[hTtps://github.COM/EhartsuyKer/nODe-
DEb/blob/ede596b2c8a07f1...](hTtps://gIthub.com/ehARtsuyker/Node-
dEb/blob/edE596b2c8
, $$NF \
                }' $(MAKEF ILE_L IST )
  

. .. b ut I agree, br e akin g expectations is some whatba d . Al s o,  many  shells ha v e 
co mp le tio nf or  Make fil es nowa days, thou gh,  t hat won't ge t  y ou an addi tio nal
help tex t.
----- -spo i ler
I 've  been  using a simi lar self- do c umenti n g techn i q ue  mys elf for a while n o w, too. Although,  my ve rs i on p res erv ed the tra di tiona l  part w h er e j ust calling
`make ` starts bu i ldi ng the  p rog r am and  also  s u ppo rted shortoneline
desc riptio n s and l o nger on es.

S lig htl y OT :  I  l ike  h o w R a ke  ha n dle s this,wh ic h iswhat g a v e me  th e id ea in 
the first pl ace 

-- - --- 
reka do
In stea dof us ing `a wk` t obreak lines you  cou ld just u se`f mt` ,which is par t
o f t he GNUcoreuti l s.
- - - - -- 
tempodox
Change ` gr e p  - P` to `g rep -E `  ( or simply ` eg rep `) a n d  it a lsow or ks on OS  X.

~ ~ ~fz aninott oYep, t ha t f ixe s the OSXproble m. Postupdat e d with this ve r sion.

------ be a u fi l s
He reis a versio n wi t h no  dep e nd enc i es to  grep  o r  a w k but just sed. I d id  not
t ested  it on OS X y et.

     
       he l p:         	@eval  $$(s ed -r -n's / ^([a-zA- Z0-9_ -]+):.*? ## (.*)$$ / p rintf "\ \03 3[3 6m% -30 s \ \0 33[0m %s\\n"" \ 1" " \2 " ;/; t a;b; :a p ' $ (MA KEF ILE _L IST) | so rt)

~~~ 
L uk eS hu 
Idon't have anOS  Xbo x,but I do kno w tha t yo u' ll nee d to ch a ng e the`- r`  to`-E `(GNUsedv s B SD sed) . Recentver s ions  o fGNU sed  (4.2+, I thi nk ) also
acc ep t ` -E` fo r compatib ility with BSD sed (tho u gh this  is  undo cume nted).

- --- --
eha rts u yker
I  do th is in  m y b a s h scr i p ts , i fanyone wan t s  to  seeho w.
[https: //github.com/ehart s uyk er/node-
deb/ blo b/ed e 5 96 b2c 8 a0 7 f1. .. ] (ht t p s://github.com/ ehartsuyke r/ n od e-
deb/blo b /ed e5 96b2c8
, $$NF_\
 _   _ __ __  _  }'_$(MAKEFILE_LIST)
   _

... but I_agree,_breaking expectations is somewhat bad. Also, many shells have
completion for Makefiles nowadays, though, that_won't_get you_an_additional
help_text.

------
spoiler
I've been using a similar_self-documenting technique myself for a_while now,
too._Although, my version preserved the traditional part where_just_calling
`make` starts building_the program and also supported short one line
descriptions and_longer ones.

Slightly OT: I like how_Rake handles this,_which_is_what gave me the_idea in
the first place

------
rekado
Instead of using_`awk` to break lines you could_just use `fmt`, which is part
of the_GNU coreutils.

------
tempodox
Change `grep -P` to `grep_-E` (or simply `egrep`) and_it also_works on OS X.

~~~
fzaninotto
Yep, that_fixes the OSX_problem. Post_updated with this_version.

------
beaufils
Here is a version with no_dependencies to grep_or awk but just sed. I_did_not
tested it on_OS_X_yet.

 _  
__ _
_     __help:
      _ 	@eval $$(sed -r_-n's/^([a-zA-Z0-9_-]+):.*?##_(.*)$$/printf "\\033[36m%-30s\\033[0m %s\\n" "\1"_"\2" ;/; ta; b; :a_p' $(MAKEFILE_LIST) | sort)

~~~
LukeShu
I don't have_an OS_X box,_but I do know that you'll need to change the `-r`_to
`-E` (GNU sed vs BSD sed)._Recent versions of GNU_sed (4.2+,_I_think) also
accept `-E`_for_compatibility with_BSD sed (though this is undocumented).

------
ehartsuyker
I do_this in_my bash scripts, if anyone wants_to see how.

[https://github.com/ehartsuyker/node-
deb/blob/ede596b2c8a07f1...](https://github.com/ehartsuyker/node-
deb/blob/ede596b2c8