24 lines
555 B
Makefile
24 lines
555 B
Makefile
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 {} \;
|