added install target

This commit is contained in:
tater 2018-07-14 16:58:08 -04:00
parent 54abc1114b
commit 8496e64dc5

View File

@ -1,7 +1,10 @@
PROG := tdfiglet PROG := tdfiglet
SRC := tdfiglet.c SRC := tdfiglet.c
PREFIX ?= /usr/local
FONTS := fonts/*
FONTDIR := $(PREFIX)/share/$(PROG)/fonts
CC ?= cc CC ?= cc
CFLAGS += -std=c99 -Wall CFLAGS += -DFONT_DIR=\"$(FONTDIR)\" -std=c99 -Wall
UNAME := $(shell sh -c 'uname -s 2>/dev/null') UNAME := $(shell sh -c 'uname -s 2>/dev/null')
@ -13,10 +16,17 @@ endif
default: $(SRC) default: $(SRC)
$(CC) $(CFLAGS) $(LDFLAGS) $(SRC) -o $(PROG) $(CC) $(CFLAGS) $(LDFLAGS) $(SRC) -o $(PROG)
.PHONY: debug clean .PHONY: debug clean install
install:
install -m 0755 -d $(PREFIX)/bin
install -m 0755 -d $(FONTDIR)
install -m 0755 $(PROG) $(PREFIX)/bin/$(PROG)
for i in $(FONTS) ; do install -m 0644 $$i $(FONTDIR) ; done
debug: $(SRC) debug: $(SRC)
$(CC) -DDEBUG -g $(CFLAGS) $(LDFLAGS) $(SRC) -o $(PROG) $(CC) -DDEBUG -g $(CFLAGS) $(LDFLAGS) $(SRC) -o $(PROG)
clean: clean:
rm -rf $(PROG) $(PROG).dSYM rm -rf $(PROG) $(PROG).dSYM