Skip to content

Instantly share code, notes, and snippets.

View Fifan31's full-sized avatar

AIME Stéphan Fifan31

  • Toulouse, FRANCE
View GitHub Profile
@Fifan31
Fifan31 / list_targets.sh
Created February 3, 2016 08:40 — forked from pvdb/list_targets.sh
List all targets (sometimes incorrectly referred to as "goals") in a GNU Makefile
#
# this gist can be used to list all targets, or - more correctly - rules,
# that are defined in a Makefile (and possibly other included Makefiles)
# and is inspired by Jack Kelly's reply to a StackOverflow question:
#
# http://stackoverflow.com/questions/3063507/list-goals-targets-in-gnu-make/3632592#3632592
#
# I also found this script - http://www.shelldorado.com/scripts/cmds/targets - which does
# something similar using awk, but it extracts targets from the "static" rules from a single
# Makefile, meaning it ignores any included Makefiles, as well as targets from "dynamic" rules
@Fifan31
Fifan31 / source.py
Created January 5, 2016 08:21 — forked from mammadori/source.py
Python: "source" a shell script and read variables
from subprocess import Popen, PIPE
from os import environ
def source(script, update=True, clean=True):
"""
Source variables from a shell script
import them in the environment (if update==True)
and report only the script variables (if clean==True)
"""