wm: ticl

ref: 66e66acea622b6183cdf8767c4d268bfe100bce0
dir: /Makefile/

View raw version
# This work is dedicated to the public domain.
# See COPYING file for more information.

PREFIX = /usr/local

CC     = cc
CFLAGS = -g -std=c89 -Wall -Wextra -pedantic -Wfatal-errors -Wconversion\
	 -Wstrict-prototypes -Wold-style-definition\
	 -D_POSIX_C_SOURCE=200809L
#CFLAGS += -fsanitize=address -fno-omit-frame-pointer
#LDFLAGS = -fsanitize=address

VERSION != date '+%Y-%m-%d'
PROGRAM = ticl
SOURCES = main.c htable.c
HEADERS = htable.h util.c
OBJECTS = $(SOURCES:.c=.o)

all: clean $(PROGRAM)

$(PROGRAM): $(OBJECTS)
	$(CC) -o $@ $(OBJECTS) $(LDFLAGS)

.c.o:
	$(CC) -c $(CFLAGS) $<

clean:
	rm -f $(PROGRAM) $(OBJECTS) $(PROGRAM)-$(VERSION).tar.gz

dist: clean
	mkdir -p $(PROGRAM)-$(VERSION)
	cp -R README COPYING Makefile $(SOURCES) $(HEADERS)\
		$(PROGRAM)-$(VERSION)
	tar -cf	$(PROGRAM)-$(VERSION).tar $(PROGRAM)-$(VERSION)
	gzip $(PROGRAM)-$(VERSION).tar
	rm -rf $(PROGRAM)-$(VERSION)

install: all
	mkdir -p $(DESTDIR)$(PREFIX)/bin
	cp -f $(PROGRAM) $(DESTDIR)$(PREFIX)/bin
	chmod 755 $(DESTDIR)$(PREFIX)/bin/$(PROGRAM)

uninstall:
	rm -f $(DESTDIR)$(PREFIX)/bin/$(PROGRAM)

.PHONY: all clean dist install uninstall