wm: ticl

ref: 8d0c143cd5f978544806f8b58bcefc22aef92cb5
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 -isystem ./picoev/
#CFLAGS += -fsanitize=address -fno-omit-frame-pointer
#LDFLAGS = -fsanitize=address
LDFLAGS =  -L ./picoev/ -l picoev

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

all: clean libpicoev.a $(PROGRAM)

libpicoev.a:
	cd picoev && $(MAKE) libpicoev.a LINUX_BUILD=1 CC_DEBUG_FLAGS=-g

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

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

clean:
	rm -f $(PROGRAM) $(OBJECTS) $(PROGRAM)-$(VERSION).tar.gz
	cd picoev && $(MAKE) clean

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