X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=Makefile;h=d440794f88168fdd19f26497f7ad6fc9307c2d0a;hb=01f74b8509235c66ddd0d8db37e8ec1fe0fcbf52;hp=5d5dbb8028764b886bc49ece9e2ab412de2014f5;hpb=54b1d6ef8351e1842e246ad5efbb2268d2243513;p=cp210x.git diff --git a/Makefile b/Makefile index 5d5dbb8..d440794 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,86 @@ -# CP2101 Makefile - -ifeq ("$(src)", "") - include Makefile.config - include Makefile$(KVER1)$(KVER2) -else - include $(src)/Makefile.config - include $(src)/Makefile$(KVER1)$(KVER2) +# Makefile for newer cp2101 driver, we call cp210x +# Essentially, it makes a debian source package which +# then can be built by pbuilder, etc. + +DEBDIST = hardy +BUILD = build +KVER := $(shell uname -r) +KSRCVER := $(shell echo $(KVER) | sed -e 's/-[0-9][^-]*-[a-zA-Z][^-]*$$//') +PKGVER = 0.11 + +REPORELEASE := $(shell svn info 2>/dev/null | grep "Revision: " | sed -e s'/^[^0-9]*\([0-9]*\).*$$/\1/') +ifeq (,$(REPORELEASE)) + REPORELEASE := $(shell git svn info 2>/dev/null | grep "Revision: " | sed -e s'/^[^0-9]*\([0-9]*\).*$$/\1/') +endif +ifeq (,$(REPORELEASE)) + $(error You much check the code out from svn using svn or git) endif +DEBRELEASE := 0tmi$(REPORELEASE) +DEBVER := $(PKGVER)-$(DEBRELEASE) +RFC822DATE := $(shell date --rfc-822) +ROOTNAME := cp210x +PACKAGE := $(ROOTNAME)-module-$(KVER) +TARFILE := $(PACKAGE)_$(DEBVER).orig.tar.gz +DEBSRC := $(PACKAGE)-$(PKGVER) +ARCH := $(shell dpkg-architecture -qDEB_HOST_ARCH) +DEBFILE := $(BUILD)/$(PACKAGE)_$(DEBVER)_$(ARCH).deb +DEBSRCFILE := $(BUILD)/$(PACKAGE)_$(DEBVER).dsc + + +source: $(DEBSRCFILE) +$(DEBSRCFILE): $(BUILD)/debian-stamp + cd $(BUILD) && dpkg-source -b $(DEBSRC) + touch $@ + + +binary: $(DEBFILE) +$(DEBFILE): $(BUILD)/debian-stamp + cd $(BUILD)/$(DEBSRC) && dpkg-buildpackage -sa -us -uc + + +$(BUILD)/src-stamp: $(wildcard src/*) + mkdir -p $(BUILD) + rm -rf $(BUILD)/$(DEBSRC) + cp -a src $(BUILD)/$(DEBSRC) + find $(BUILD)/$(DEBSRC) -name .svn -type d -exec rm -rf "{}" ";" 2>/dev/null || exit 0 + tar -C $(BUILD) -czf $(BUILD)/$(TARFILE) $(DEBSRC) + touch $@ + + +configure: $(BUILD)/debian-stamp +$(BUILD)/debian-stamp: $(BUILD)/src-stamp $(wildcard debian.in/*) + mkdir -p $(BUILD)/$(DEBSRC)/debian + rsync --quiet -avz --exclude=.svn/ debian.in/ $(BUILD)/$(DEBSRC)/debian/ + perl -i -pe 's/xxPACKAGExx/$(PACKAGE)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxROOTNAMExx/$(ROOTNAME)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxPKGVERxx/$(PKGVER)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxKVERxx/$(KVER)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxKSRCVERxx/$(KSRCVER)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxDEBVERxx/$(DEBVER)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxDEBDISTxx/$(DEBDIST)/g' $(BUILD)/$(DEBSRC)/debian/* + perl -i -pe 's/xxRFC822DATExx/$(RFC822DATE)/g' $(BUILD)/$(DEBSRC)/debian/* + touch $@ + + +clean: + rm -rf $(BUILD) + + +debug: + @echo "BUILD = $(BUILD)" + @echo "KVER = $(KVER)" + @echo "PKGVER = $(PKGVER)" + @echo "REPORELEASE = |$(REPORELEASE)|" + @echo "DEBRELEASE = $(DEBRELEASE)" + @echo "DEBVER = $(DEBVER)" + @echo "RFC822DATE = $(RFC822DATE)" + @echo "PACKAGE = $(PACKAGE)" + @echo "TARFILE = $(TARFILE)" + @echo "DEBSRC = $(DEBSRC)" + @echo "ARCH = $(ARCH)" + @echo "DEBFILE = $(BUILD)/$(PACKAGE)_$(DEBVER)_$(ARCH).deb" + @echo "DEBSRCFILE = $(BUILD)/$(PACKAGE)_$(DEBVER).dsc" + + +.PHONY: clean binary source configure