From 8ce44cce8e385d1875b776e7e4fb87d4b4393e69 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Mon, 2 May 2016 04:45:16 -0400 Subject: implement `make help` (and a couple other helpful commands) --- Makefile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index fe7f69d..19f559d 100644 --- a/Makefile +++ b/Makefile @@ -31,7 +31,13 @@ ALLLDFLAGS = $(shell pkg-config --libs $(LIBS)) $(LDFLAGS) MAKEDEPEND = $(CC) $(ALLCFLAGS) -M -MP -MT '$@ $(@:$(BUILD)%.o=$(BUILD).%.d)' -build: $(OUT) $(DOUT) $(COUT) +all: $(OUT) $(DOUT) $(COUT) ## Build all of the targets + +run: $(OUT) ## Build and run the standalone runes terminal + @./$(OUT) + +run-daemon: $(DOUT) $(COUT) ## Build and run the runes daemon + @./$(DOUT) $(OUT): $(OBJ) libvt100/libvt100.a $(CC) $(ALLLDFLAGS) -o $@ $^ @@ -58,11 +64,14 @@ $(SRC)%.c: $(SRC)%.l $(SRC)%.h: $(SRC)%.l $(LEX) --header-file=$(<:.l=.h) -o /dev/null $< -clean: +clean: ## Remove build files cd libvt100 && make clean rm -f $(OUT) $(OBJ) $(OBJ:$(BUILD)%.o=$(BUILD).%.d) $(DOUT) $(DOBJ) $(DOBJ:$(BUILD)%.o=$(BUILD).%.d) $(COUT) $(COBJ) $(COBJ:$(BUILD)%.o=$(BUILD).%.d) @rmdir -p $(BUILD) > /dev/null 2>&1 +help: + @grep -HE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":|##"}; {printf "\033[36m%-20s\033[0m %s\n", $$2, $$4}' + -include $(OBJ:$(BUILD)%.o=$(BUILD).%.d) -.PHONY: build clean +.PHONY: all run run-daemon clean help -- cgit v1.2.3-54-g00ecf