mirror of
https://codeberg.org/kyonshi/ttrpg-fortunes.git
synced 2026-01-02 01:53:46 +01:00
make comments
This commit is contained in:
25
Makefile
25
Makefile
@@ -1,17 +1,38 @@
|
|||||||
|
########## Variables ##########
|
||||||
|
|
||||||
fortune_directory = /usr/share/fortune
|
fortune_directory = /usr/share/fortune
|
||||||
|
|
||||||
|
# This just equals 'ttrpg.dat', but if someone wants to split it into separate
|
||||||
|
# files, e.g. 'D20.dat' and 'WW.dat', the they would be included.
|
||||||
|
|
||||||
dat_files = $(wildcard *.dat)
|
dat_files = $(wildcard *.dat)
|
||||||
|
|
||||||
|
# Each .dat file has a corresponding fortune file to be included. This
|
||||||
|
# apparently convoluted mess is just here to select fortune files, and not the
|
||||||
|
# Makefile and README.
|
||||||
fortune_files = $(patsubst %.dat, %, $(dat_files))
|
fortune_files = $(patsubst %.dat, %, $(dat_files))
|
||||||
fortune_files += $(dat_files)
|
fortune_files += $(dat_files)
|
||||||
|
|
||||||
|
# `patsubst` = 'path substitution', so
|
||||||
|
# 'ttrpg' --> /usr/share/fortune/ttrpg
|
||||||
|
# Now `make` knows (at long last) what you want installed.
|
||||||
targets = $(patsubst %, $(fortune_directory)/%, $(fortune_files))
|
targets = $(patsubst %, $(fortune_directory)/%, $(fortune_files))
|
||||||
|
|
||||||
$(targets): $(fortune_directory)/%: %
|
########## Rules ##########
|
||||||
install -pm644 $< $@
|
|
||||||
|
|
||||||
.PHONY: install
|
.PHONY: install
|
||||||
install: $(targets)
|
install: $(targets)
|
||||||
|
|
||||||
|
# Ignore the `$(targets): ` section; the rule is about how to make
|
||||||
|
# /usr/share/fortune/[that] from [this].
|
||||||
|
# The next linen says you just install this (`$<`) from that (`$@`).
|
||||||
|
# We use `install` rather than the more familiar `cp`, because cause back in the
|
||||||
|
# days of Unix-yore, Xenox had a patent on the concept of a copy and
|
||||||
|
# Mathematicians had to do their own legal work as international law hadn't been
|
||||||
|
# established. Now I'd like to digress from my prepared remarks to discuss how
|
||||||
|
# I invented the terlet...
|
||||||
|
$(targets): $(fortune_directory)/%: %
|
||||||
|
install -pm644 $< $@
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
$(RM) $(wildcard $(targets))
|
$(RM) $(wildcard $(targets))
|
||||||
|
|||||||
Reference in New Issue
Block a user