aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorEliteTK <tomasz.kramkowski@gmail.com>2015-06-19 19:12:12 +0100
committerEliteTK <tomasz.kramkowski@gmail.com>2015-06-19 19:12:12 +0100
commitda87fcf25e0c94e57f00df84679cd6fadc56ed46 (patch)
tree3c53eea9db01039990455af870a2ca65e7e5a123 /Makefile
parent75d2e00662416224f4b745e0004f48f1fc1d9665 (diff)
parent7bf25fb8f0e4643a67894417a95d39e5901b1824 (diff)
downloadc-stuff-da87fcf25e0c94e57f00df84679cd6fadc56ed46.tar.gz
c-stuff-da87fcf25e0c94e57f00df84679cd6fadc56ed46.tar.xz
c-stuff-da87fcf25e0c94e57f00df84679cd6fadc56ed46.zip
Merge branch 'master' of https://github.com/EliteTK/c-stuff
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile38
1 files changed, 38 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..f5da2e9
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,38 @@
+CFLAGS = -std=gnu11 -Wall -Wextra
+LDFLAGS = -Wl,--as-needed
+
+ifeq ($(DEBUG), 1)
+ CFLAGS += -Og -g
+else
+ CFLAGS += -O2
+endif
+
+INSTALL = install -Dm755
+
+prefix = /usr/local
+bindir = $(prefix)/bin
+
+all:
+ @echo 'Error, target not specified.'
+ @make --no-print-directory help
+
+help:
+ @echo 'Usage:'
+ @echo ' To compile <filename>.c `make <filename>`'
+ @echo ' To install <filename> `make target=<filename> install`'
+ @echo ' To uninstall <filename> `make target=<filename> uninstall`'
+ @echo ' To clean up `make clean`'
+
+
+$(DESTDIR)$(bindir)/%: %
+ $(INSTALL) $^ $(DESTDIR)$(bindir)/$(target)
+
+install: $(DESTDIR)$(bindir)/$(target)
+
+uninstall:
+ $(RM) "$(DESTDIR)$(bindir)/$(target)"
+
+clean:
+ find . -mindepth 1 -maxdepth 1 -executable -type f ! -name "prefix_header" -delete
+
+.PHONY : all install uninstall clean