CC=gcc
CFLAGS=-Wall -g3 -I$(BIDIR)
BIDIR=bitinfo-0.3
LDFLAGS=-I$(BIDIR)
PROYECTO=dumpbit bitdevice bit2svf
VERSION=1.3.1
PKG=bit2svf-$(VERSION)

all: $(PROYECTO) $(BIDIR)/bitinfo

$(BIDIR)/bitfile.o:
	$(MAKE) -C $(BIDIR)

bit2svf: bit2svf.o $(BIDIR)/bitfile.o parts.o commands.o bitshandle.o

bitdevice: bitdevice.o $(BIDIR)/bitfile.o

dumpbit: dumpbit.o $(BIDIR)/bitfile.o

debian/control: debian/packages debian/yada
	debian/yada rebuild control

debian/rules: debian/packages debian/yada
	debian/yada rebuild rules

deb: $(PROYECTO) debian/control debian/rules
	fakeroot dpkg-buildpackage -b -uc

tarball: clean
	cp -r ../bit2svf /tmp/$(PKG)
	-rm -rf /tmp/$(PKG)/CVS /tmp/$(PKG)/*/CVS /tmp/$(PKG)/*/*/CVS /tmp/$(PKG)/*/*/*/CVS /tmp/$(PKG)/*/*/*/*/CVS /tmp/$(PKG)/*/*/*/*/*/*/CVS /tmp/$(PKG)/*/*/*/*/*/*/CVS 2> /dev/null
	-rm -f /tmp/$(PKG)/.cvsignore /tmp/$(PKG)/*/.cvsignore /tmp/$(PKG)/*/*/.cvsignore /tmp/$(PKG)/*/*/*/.cvsignore /tmp/$(PKG)/*/*/*/*/.cvsignore /tmp/$(PKG)/*/*/*/*/*/*/.cvsignore /tmp/$(PKG)/*/*/*/*/*/*/.cvsignore 2> /dev/null
	-rm -f /tmp/$(PKG)/*.epr /tmp/$(PKG)/.*.dst /tmp/$(PKG)/Changelog /tmp/$(PKG)/lista 2> /dev/null
	cd /tmp ; tar zcvf $(PKG).tar.gz $(PKG)
	rm -r /tmp/$(PKG)
	mv /tmp/$(PKG).tar.gz .

clean:
	-rm -f *.o $(PROYECTO) .*~
	$(MAKE) -C $(BIDIR) clean
	debian/rules clean


install:
	mkdir -p /usr/share/bit2svf/
	cp -Rp templates/* /usr/share/bit2svf/
	cp -Rp bitdevice /usr/bin/
	cp -Rp bit2svf /usr/bin/
