diff --git a/Makefile b/Makefile index 43cdda6..eb3ab60 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,24 @@ CC = cc CFLAGS = -O4 -Ofast -march=native -flto -fomit-frame-pointer -finline-functions -funroll-loops -std=c2x DIR = cgi +PREFIX = ~ + +FIND = find +CP = cp SOURCES = $(wildcard $(DIR)/*.c) TARGETS = $(patsubst $(DIR)/%.c,%,$(SOURCES)) +.PHONY: all install clean + all: $(TARGETS) %: $(DIR)/%.c $(CC) $(CFLAGS) -o $(DIR)/$@ $< +install: $(TARGETS) + mkdir -p $(PREFIX)/$(DIR) + $(FIND) $(DIR)/ -type f -exec file {} \; | grep "executable" | cut -d: -f1 | xargs -I {} $(CP) {} $(PREFIX)/$(DIR) + clean: - find $(DIR)/ -type f ! -name '*.c' -exec rm -f {} \; + $(FIND) $(DIR)/ -type f ! -name '*.c' -exec rm -f {} \;