# gmake

NAME = xls2txt
VERSION = 0.17
PKG = $(NAME)-$(VERSION)
FILES = Makefile xls2txt.[ch] ole.c cp.c ummap.[ch] ieee754.c list.h

PREFIX ?= /usr/local
CFLAGS ?= -O2 -DNDEBUG -g -Wall -Wno-parentheses -Wno-unknown-pragmas
LDFLAGS ?= -lm

xls2txt: xls2txt.o ole.o cp.o ummap.o ieee754.o

xls2txt.o: xls2txt.c xls2txt.h
	$(CC) $(CFLAGS) -DVERSION=$(VERSION) -c $< -o $@

install: xls2txt
	install -s $< $(PREFIX)/bin

clean:
	rm -f xls2txt $(addsuffix .o,$(basename $(filter %.c %.[ch],$(FILES))))

dist:
	ln -s . $(PKG)
	tar czf $(PKG).tar.gz --group=root --owner=root $(addprefix $(PKG)/, $(FILES)); \
	rm $(PKG)

.PHONY: install clean dist
