lazysphere/Makefile

48 lines
836 B
Makefile
Raw Normal View History

2023-04-27 18:38:16 +00:00
CC = gcc
2023-05-01 22:43:32 +00:00
SOURCE = src
2023-04-27 18:38:16 +00:00
2023-05-01 22:43:32 +00:00
MAJOR = 0
MINOR = 0
PATCH = 1
INCFLAGS = $(shell echo $(SOURCE) | xargs printf -- '-I%s')
CCFLAGS = -std=c99 -Wall -Wextra -pedantic -O2
CCFLAGS += -D_DEFAULT_SOURCE -DMAJOR=$(MAJOR) -DMINOR=$(MINOR) -DPATCH=$(PATCH) -DCHECK_LINK
2023-04-27 18:38:16 +00:00
CCFLAGS += $(INCFLAGS)
LDFLAGS += $(INCFLAGS)
BIN = bin
APP = $(BIN)/app
2023-05-01 22:43:32 +00:00
SRC = $(shell find $(SOURCE) -name "*.c")
DIR = $(shell find $(SOURCE) -type d)
2023-04-27 18:38:16 +00:00
OBJ = $(SRC:%.c=$(BIN)/%.o)
.PHONY: dirs run clean build install uninstall
EOF: clean build
dirs:
2023-05-01 22:43:32 +00:00
echo $(DIR) | xargs printf -- '$(BIN)/%s\n' | xargs mkdir -p
2023-04-27 18:38:16 +00:00
run: build
$(APP)
build: dirs ${OBJ}
${CC} -o $(APP) $(filter %.o,$^) $(LDFLAGS)
$(BIN)/%.o: %.c
$(CC) -o $@ -c $< $(CCFLAGS)
clean:
rm -rf $(APP)
rm -rf $(BIN)
install:
cp $(APP) /usr/local/bin/lazysphere
uninstall:
rm /usr/local/bin/lazysphere