Last active
December 20, 2016 01:02
-
-
Save milesrout/879ebd433b61535aef137a70e8b26040 to your computer and use it in GitHub Desktop.
Lakefile (lake is logical make, a reimplementation of make built around the concept that make is really just a constructive logic programming language).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Traditional Makefile style: (different wildcard symbol) | |
# \forall_{$} $.c -> $.o | |
*.o: *.c | |
gcc -c $.c -o $.o | |
# From and to variables: | |
# Using $^ (from) and $v (to) | |
*.o: *.c | |
gcc -c $^ -o $v | |
# Multi-wildcard rule: | |
# This will generate a rule for every architecture-specific file. e.g. | |
# | |
# fs.o: os/win32/fs.c | |
# fs.o: os/macos/fs.c | |
# fs.o: os/linux/fs.c | |
# | |
# The build system will apply the BFINAE (build failure is not an error) | |
# rule to disambiguate. You should ensure only one of those three files will | |
# successfully build on a given platform. | |
# What is special here is not really multiple wildcards, but not requiring every | |
# universally quantified variable to be in the target. | |
# \forall_{$1} \forall_{$2} os/$2/$1.c -> $1.o | |
$1.o: os/$2/$1.c | |
gcc -c $^ -o $v | |
# Strict dependencies: (!-rule) | |
# The ! modifier creates a strict dependency, so this rule is only in effect | |
# if $.bib has changed, while the normal behaviour is that if *any* dependency | |
# has changed the file will be rebuilt. | |
# A numbered wildcard can use $!n instead of $n. | |
*.bbl: *.ltx !*.bib | |
bibtex $.ltx | |
# Fixed points: | |
# A rule where a file appears before and after the colon will be run | |
# until it reaches a fixed-point for all of its targets. | |
*.pdf *.aux *.bbl: *.ltx *.aux *.bbl | |
pdflatex $.ltx | |
# Dependency-generating rule: (@-rule) | |
# This will run the given command, and its standard output should be | |
# a set of dependencies that anything that depends on this file should | |
# also depend upon. | |
# Note: **/*.c doesn't mean '$1$1/$1.c', it means '$1.c|$2/$1.c|$3/$2/$1.c|...'. | |
@**/*.c: | |
sed -n 's/#include "\(.*\)"/\1/p' $^ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment