Hacker News new | past | comments | ask | show | jobs | submit login

Most systems I use have GNU make 3.81 installed. GNU make 3.81 added the special target .ONESHELL which makes code like the following possible. I'm not sure if it is a good idea, but it does remove the dependency that make has on shell programming.

    .ONESHELL:

    SHELL = /usr/bin/python

    VAR := lorem ipsum

    all:
        @
        import re
        
        n = 3
        
        print('make variable: $(VAR)')
        print('local variable n: {}'.format(n))
        
        rx = re.compile('\d+')
        s = 'foo 17'

        m = rx.search(s)
        if m:
          print('has number: {}'.format(s))
        else:
          print('no number: {}'.format(s))






Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: