2pend/Makefile

40 lines
781 B
Makefile
Raw Permalink Normal View History

2019-03-18 21:15:33 -07:00
PREFIX=
CC=cc
CFLAGS=-O3 -std=gnu99
2019-09-22 19:35:23 -07:00
LIBS=-lm
2019-03-18 21:15:33 -07:00
NAME=2pend
all: $(NAME)
clean:
2019-06-11 16:03:49 -07:00
rm -f $(NAME)
2019-03-18 21:15:33 -07:00
run: $(NAME)
./$(NAME)
$(NAME): $(NAME).c
2019-03-18 21:15:33 -07:00
$(CC) $(NAME).c $(LIBS) $(CFLAGS) -o $(NAME)
install: $(NAME)
@prefix="$(PREFIX)"; \
if [[ ! $$prefix ]]; then \
read -p $$'\033[1mWhere do you want to install? (default: /usr/local) \033[0m' prefix; \
fi; \
if [[ ! $$prefix ]]; then \
prefix="/usr/local"; \
fi; \
mkdir -pv $$prefix/bin $$prefix/share/man/man1 \
&& cp -v $(NAME) $$prefix/bin/
2019-03-18 21:15:33 -07:00
uninstall:
@prefix="$(PREFIX)"; \
if [[ ! $$prefix ]]; then \
read -p $$'\033[1mWhere do you want to uninstall from? (default: /usr/local) \033[0m' prefix; \
fi; \
if [[ ! $$prefix ]]; then \
prefix="/usr/local"; \
fi; \
echo "Deleting..."; \
rm -rvf $$prefix/bin/$(NAME)
2019-03-18 21:15:33 -07:00