summaryrefslogtreecommitdiff
path: root/meme/Makefile.c-common
diff options
context:
space:
mode:
authorWerner Almesberger <werner@almesberger.net>2014-09-12 02:54:30 (GMT)
committerWerner Almesberger <werner@almesberger.net>2014-09-12 03:13:49 (GMT)
commit2bc5b2f3ab23a4f75bbb8c23cf437519bb332808 (patch)
treeae092628f305c449572ce3f5304e6b3164e77e68 /meme/Makefile.c-common
parente41c8e654bbe68360aec22b35b424a8849947a98 (diff)
downloadmisc-2bc5b2f3ab23a4f75bbb8c23cf437519bb332808.zip
misc-2bc5b2f3ab23a4f75bbb8c23cf437519bb332808.tar.gz
misc-2bc5b2f3ab23a4f75bbb8c23cf437519bb332808.tar.bz2
measmesh/: renamed to meme/
Too much typing ;-)
Diffstat (limited to 'meme/Makefile.c-common')
-rwxr-xr-xmeme/Makefile.c-common57
1 files changed, 57 insertions, 0 deletions
diff --git a/meme/Makefile.c-common b/meme/Makefile.c-common
new file mode 100755
index 0000000..4d05ec2
--- /dev/null
+++ b/meme/Makefile.c-common
@@ -0,0 +1,57 @@
+#
+# common/Makefile.c-common - Common Makefile items for C
+#
+# Written 2013, 2014 by Werner Almesberger
+# Copyright 2013, 2014 by Werner Almesberger
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+
+SHELL = /bin/bash
+
+
+# Make sure "all" comes first
+
+all::
+
+# ----- Verbosity control -----------------------------------------------------
+
+CC_normal := $(CC)
+CPP_normal := $(CPP)
+DEPEND_normal = $(CPP_normal) $(CFLAGS) -MM -MG
+
+ifeq ($(V),1)
+ CC = $(CC_normal)
+ BUILD =
+ DEPEND = $(DEPEND_normal)
+else
+ CC = @echo " CC " $@ && $(CC_normal)
+ BUILD = @echo " BUILD " $@ &&
+ DEPEND = @$(DEPEND_normal)
+endif
+
+# ----- Dependencies ----------------------------------------------------------
+
+-include $(OBJS:.o=.d)
+
+MKDEP = \
+ $(DEPEND) $< | \
+ sed \
+ -e 's|^$(basename $(notdir $<)).o:|$@:|' \
+ -e '/^\(.*:\)\? */{p;s///;s/ *\\\?$$/ /;s/ */:\n/g;H;}' \
+ -e '$${g;p;}' \
+ -e d >$(basename $@).d; \
+ [ "$${PIPESTATUS[*]}" = "0 0" ] || \
+ { rm -f $(basename $@).d; exit 1; }
+
+%.o: %.c
+ $(CC) $(CFLAGS) -c $<
+ $(MKDEP)
+
+# ----- Cleanup ---------------------------------------------------------------
+
+clean::
+ rm -f $(OBJS) $(OBJS:.o=.d)