about summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorThordur Bjornsson <thorduri@secnorth.net>2012-11-04 17:16:14 +0100
committerThordur Bjornsson <thorduri@secnorth.net>2012-11-04 17:16:14 +0100
commit65780fdfff8cb81e99b7b5ba8d69391d81c97aba (patch)
treee0c5c97743638136ff344b08136fd0156c154221 /Makefile
downloadministat-65780fdfff8cb81e99b7b5ba8d69391d81c97aba.tar.gz
ministat-65780fdfff8cb81e99b7b5ba8d69391d81c97aba.tar.xz
ministat-65780fdfff8cb81e99b7b5ba8d69391d81c97aba.zip
initial import
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile41
1 files changed, 41 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..25d8394
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,41 @@
+CC ?= clang 
+INSTALLPATH ?= /usr/bin
+
+CFLAGS += -Wall -Werror
+LDFLAGS += -lm
+
+BIN = ministat 
+SRC = $(BIN).c
+
+# No user serviceable parts below this line.
+OBJS = $(addprefix $(OBJ), $(SRC:.c=.o))
+DEPS = $(addsuffix .depend, $(OBJS))
+OBJ  = obj
+
+all: obj $(OBJ)/$(BIN)
+
+obj:
+	-mkdir obj
+
+$(OBJ)$/(BIN): $(OBJS)
+	$(CC) -o $@ $^ ${LDFLAGS}
+
+
+$(OBJ)/%.o: %.c
+	@echo "Generating $@.depend"
+	@$(CC) $(CFLAGS) -MM $< | \
+	sed 's,$*\.o[ :]*,$@ $@.depend : ,g' >> $@.depend
+	$(CC) $(CFLAGS) -o $@ -c $<
+
+depend:
+	@echo "Dependencies are automatically generated."
+
+install:
+	install -m 0755 $(OBJ)/$(BIN) $(INSTALLPATH)
+
+clean:
+	-rm -rf $(BIN) obj *.core
+
+.PHONY: all depend install clean
+
+-include $(DEPS)