wm: ticl

ref: 5ff9649e6c51bae0dd09f218e4943fa5f4d458be
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 -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 utils.c
HEADERS = htable.h utils.h
OBJECTS = $(SOURCES:.c=.o)

all: $(PROGRAM)

main.o: htable.o utils.o
htable.o: htable.c htable.h
utils.o: utils.c utils.h

$(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