# Makefile for Linux binaries. (C) Geoffrey Reynolds, July 2006.
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; either version 2 of the License, or
#   (at your option) any later version.

vpath %.c ..
vpath %.h ..
vpath README ..

CFLAGS=-O2 -fomit-frame-pointer -march=$(ARCH)
CPPFLAGS=-Wall -DNDEBUG $(ASM_FLAGS)
LDFLAGS=-s
LDLIBS=-lm

CC=gcc -V4.1

TAR=tar -c
GZIP=gzip -9
SED=sed
FMT=fmt

.PHONY: clean realclean

TARBALL=sr5sieve-$(FULL_VER)-linux32-$(ARCH).tar.gz
PROGS=sr5sieve
DOCS=BUILD README

$(TARBALL): $(DOCS) $(PROGS)
	$(TAR) $^ | $(GZIP) > $@

sr5sieve: $(SR5SIEVE_OBJS)

BUILD: BUILD.in
	$(SED) -e s/VERSION/$(FULL_VER)/g \
	       -e s/FLAGS/"$(CPPFLAGS) $(CFLAGS)/g" $< | $(FMT) > $@

clean:
	rm -f *.o $(PROGS) BUILD

realclean: clean
	rm -f *.tar.gz
