Cleanup Makefile

Signed-off-by: Adrien Gallouët <adrien@gallouet.fr>
This commit is contained in:
Adrien Gallouët
2019-12-31 20:04:52 +00:00
parent c75f5d5620
commit 1ae7775ce1

View File

@@ -2,11 +2,12 @@ NAME := glorytun
VERSION := $(shell ./version.sh)
DIST := $(NAME)-$(VERSION)
CC ?= cc
DESTDIR ?=
CC ?= gcc
INSTALL ?= install
prefix ?= /usr
CFLAGS ?= -std=c11 -O2 -Wall -fstack-protector-strong
Q := @
CFLAGS := -std=c11 -O2 -Wall -fstack-protector-strong
FLAGS := $(CFLAGS) $(LDFLAGS) $(CPPFLAGS)
FLAGS += -DPACKAGE_NAME=\"$(NAME)\" -DPACKAGE_VERSION=\"$(VERSION)\"
@@ -19,22 +20,15 @@ HDR := argz/argz.h mud/mud.h mud/aegis256/aegis256.h $(wildcard src/*.h)
$(NAME): $(SRC) $(HDR)
@echo "$(NAME)"
@$(CC) $(FLAGS) -o $(NAME) $(SRC) -lsodium
$(Q)$(CC) $(FLAGS) -o $(NAME) $(SRC) -lsodium
.PHONY: install
install: $(NAME)
@echo "$(DESTDIR)$(prefix)/bin/$(NAME)"
@$(INSTALL) -m 755 -d $(DESTDIR)$(prefix)/bin
@$(INSTALL) -m 755 -s $(NAME) $(DESTDIR)$(prefix)/bin
$(Q)install -m 755 -d $(DESTDIR)$(prefix)/bin
$(Q)install -m 755 -s $(NAME) $(DESTDIR)$(prefix)/bin
.PHONY: clean
clean:
@rm -f "$(NAME)"
@rm -f "$(DIST).tar.gz"
.PHONY: dist
dist:
@echo "$(DIST).tar.gz"
@(git --git-dir=.git ls-files --recurse-submodules -- ':!:.*' ':!:**/.*' && echo VERSION) | ( \
tar zcf $(DIST).tar.gz -T- --transform 's:^:$(DIST)/:' || \
tar zcf $(DIST).tar.gz -T- -s ':^:$(DIST)/:' ) 2>/dev/null
$(Q)rm -f "$(NAME)"
$(Q)rm -f "$(DIST).tar.gz"