summaryrefslogtreecommitdiff
path: root/proto/common.mk
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2016-06-15 17:39:32 -0400
committerLuke Shumaker <lukeshu@sbcglobal.net>2016-06-15 17:39:32 -0400
commitdad3de8e9835a11b1df9e718eef3faa50459ccbb (patch)
tree62e56c49e4e0cbcc5f6ad59471f8472e31100dad /proto/common.mk
parent59111cbcc57da782c3a9ca5771aa38e636960923 (diff)
re-do the Makefile to be autothing-compatible.
Diffstat (limited to 'proto/common.mk')
-rw-r--r--proto/common.mk50
1 files changed, 14 insertions, 36 deletions
diff --git a/proto/common.mk b/proto/common.mk
index 41f5c79..1496356 100644
--- a/proto/common.mk
+++ b/proto/common.mk
@@ -1,55 +1,33 @@
-# Copyright © 2015 Luke Shumaker
+# Copyright © 2015-2016 Luke Shumaker
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
-rel = $(patsubst $(abspath .)/%,./%,$(abspath $1))
-
all: build
.PHONY: all
-include $(addsuffix /Makefile,$(subdirs))
-
-generate: $(generate)
+generate: $(addprefix $(srcdir)/,$(std.gen_files))
.PHONY: generate
-configure: generate $(configure)
+configure: generate $(addprefix $(outdir)/,$(std.cfg_files))
.PHONY: configure
-build: configure $(build)
+build: configure $(addprefix $(outdir)/,$(std.out_files))
.PHONY: build
-install: build $(install)
+install: build $(addprefix $(DESTDIR),$(std.sys_files))
.PHONY: install
-# un-build
-clean:
- rm -rf -- $(build) $(build_secondary)
-.PHONY: clean
+maintainer-clean: private files=$(addprefix $(srcdir)/,$(std.gen_files) $(std.secondary_gen_files)) # un-generate
+distclean : private files=$(addprefix $(outdir)/,$(std.cfg_files) $(std.secondary_cfg_files)) # un-configure
+clean : private files=$(addprefix $(outdir)/,$(std.out_files) $(std.secondary_out_files)) # un-build
+uninstall : private files=$(addprefix $(DESTDIR),$(std.sys_files) ) # un-install
-# un-configure
distclean: clean
- rm -rf -- $(configure) $(configure_secondary)
-.PHONY: distclean
-
-# un-generate
maintainer-clean: distclean
- rm -rf -- $(generate) $(generate_secondary)
-.PHONY: maintainer-clean
-
-# un-install
-uninstall:
- rm -f -- $(install)
- rmdir -p -- $(sort $(dir $(install))) 2>/dev/null || true
-.PHONY: uninstall
-
-
-# Now, this is magic. It stores the values of environment variables,
-# so that if you change them in a way that would cause something to be
-# rebuilt, then Make knows.
-.var.%: FORCE
- $(Q)printf '%s' '$($*)' > .tmp$@ && { cmp -s .tmp$@ $@ && rm -f -- .tmp$@ || mv -Tf .tmp$@ $@; } || { rm -f -- .tmp$@; false; }
-.DELETE_ON_ERROR:
-.SECONDARY:
-.PHONY: FORCE
+clean distclean maintainer-clean uninstall:
+ rm -f -- $(sort $(filter-out %/,$(files)))
+ rm -f -r -- $(sort $(filter %/,$(files)))
+ rmdir -p -- $(sort $(dir $(files))) 2>/dev/null || true
+.PHONY: clean distclean maintainer-clean uninstall