diff --git a/Makefile b/Makefile index 061f0d8..9327402 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,12 @@ +# Taken from: https://stackoverflow.com/questions/2214575/passing-arguments-to-make-run +# If the first argument is "new"... +ifeq (new,$(firstword $(MAKECMDGOALS))) + # use the rest as arguments for "run" + NEW_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) + # ...and turn them into do-nothing targets + $(eval $(NEW_ARGS):;@:) +endif + BIN := $(shell basename $$(pwd)) PLUGINS := $(wildcard modules/*) @@ -32,7 +41,7 @@ endif LDLIBS := -lm -lpthread -lscgui -lSDL2 -lcairo -lscerror -lscstring -lscscreensaver -ldl -.PHONY: all clean install modules +.PHONY: all clean install modules new all: $(BIN) modules @@ -46,6 +55,9 @@ $(BIN): $(OBJS) $(DEPS) %.d: ; +new: + @./newmodule $(NEW_ARGS) + modules: $(PLUGINS) mkdir -p plugins @for plug in $(PLUGINS) ;\