From 65780fdfff8cb81e99b7b5ba8d69391d81c97aba Mon Sep 17 00:00:00 2001 From: Thordur Bjornsson Date: Sun, 4 Nov 2012 17:16:14 +0100 Subject: initial import --- Makefile | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Makefile (limited to 'Makefile') 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) -- cgit 1.4.1