OSDN Git Service

Define strdupa if it is not defined
[android-x86/external-efivar.git] / Makefile
index 94ee21c..8c67b9d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,44 +1,83 @@
 TOPDIR = $(shell echo $$PWD)
 
-SUBDIRS := src
-DOCDIR := /share/doc/
-VERSION = 0.1
+include $(TOPDIR)/Make.deprecated
+include $(TOPDIR)/Make.version
+include $(TOPDIR)/Make.rules
+include $(TOPDIR)/Make.defaults
+include $(TOPDIR)/Make.coverity
+include $(TOPDIR)/Make.scan-build
+
+SUBDIRS := src docs
 
-all : $(SUBDIRS)
+all : | efivar.spec Make.version
+all :
+       @set -e ; for x in $(SUBDIRS) ; do \
+               $(MAKE) -C $$x $@ ; \
+       done
+
+install :
+       @set -e ; for x in $(SUBDIRS) ; do \
+               $(MAKE) -C $$x $@ ; \
+       done
+
+abidw abicheck efivar efivar-static static:
+       $(MAKE) -C src $@
+
+abiupdate :
+       $(MAKE) clean all
+       $(MAKE) -C src abiclean abixml
 
 $(SUBDIRS) :
-       $(MAKE) -C $@ TOPDIR=$(TOPDIR) SRCDIR=$(TOPDIR)/$@/ ARCH=$(ARCH)
+       $(MAKE) -C $@
+
+brick : all
+       @set -e ; for x in $(SUBDIRS) ; do $(MAKE) -C $${x} test ; done
+
+a :
+       @if [ $${EUID} != 0 ]; then \
+               echo no 1>&2 ; \
+               exit 1 ; \
+       fi
+
+.PHONY: $(SUBDIRS) a brick abiupdate
+
+GITTAG = $(shell bash -c "echo $$(($(VERSION) + 1))")
+
+efivar.spec : | Makefile Make.version
 
 clean :
-       @for x in $(SUBDIRS) ; do make -C $${x} TOPDIR=$(TOPDIR) SRCDIR=$(TOPDIR)/$@/ ARCH=$(ARCH) $@ ; done
+       @set -e ; for x in $(SUBDIRS) ; do \
+               $(MAKE) -C $$x $@ ; \
+       done
+       @rm -vf efivar.spec
 
-install :
-       @for x in $(SUBDIRS) ; do make -C $${x} TOPDIR=$(TOPDIR) SRCDIR=$(TOPDIR)/$@/ ARCH=$(ARCH) $@ ; done
+test-archive: abicheck efivar.spec
+       @rm -rf /tmp/efivar-$(GITTAG) /tmp/efivar-$(GITTAG)-tmp
+       @mkdir -p /tmp/efivar-$(GITTAG)-tmp
+       @git archive --format=tar $(shell git branch | awk '/^*/ { print $$2 }') | ( cd /tmp/efivar-$(GITTAG)-tmp/ ; tar x )
+       @git diff | ( cd /tmp/efivar-$(GITTAG)-tmp/ ; patch -s -p1 -b -z .gitdiff )
+       @mv /tmp/efivar-$(GITTAG)-tmp/ /tmp/efivar-$(GITTAG)/
+       @cp efivar.spec /tmp/efivar-$(GITTAG)/
+       @dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/efivar-$(GITTAG).tar.bz2 efivar-$(GITTAG)
+       @rm -rf /tmp/efivar-$(GITTAG)
+       @echo "The archive is in efivar-$(GITTAG).tar.bz2"
 
-.PHONY: $(SUBDIRS) clean install
+bumpver :
+       @echo VERSION=$(GITTAG) > Make.version
+       @git add Make.version
+       git commit -m "Bump version to $(GITTAG)" -s
 
-include $(TOPDIR)/Make.rules
+tag:
+       git tag -s $(GITTAG) refs/heads/master
 
-GITTAG = $(VERSION)
-
-test-archive:
-       @rm -rf /tmp/libefivar-$(VERSION) /tmp/libefivar-$(VERSION)-tmp
-       @mkdir -p /tmp/libefivar-$(VERSION)-tmp
-       @git archive --format=tar $(shell git branch | awk '/^*/ { print $$2 }') | ( cd /tmp/libefivar-$(VERSION)-tmp/ ; tar x )
-       @git diff | ( cd /tmp/libefivar-$(VERSION)-tmp/ ; patch -s -p1 -b -z .gitdiff )
-       @mv /tmp/libefivar-$(VERSION)-tmp/ /tmp/libefivar-$(VERSION)/
-       @dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/libefivar-$(VERSION).tar.bz2 libefivar-$(VERSION)
-       @rm -rf /tmp/libefivar-$(VERSION)
-       @echo "The archive is in libefivar-$(VERSION).tar.bz2"
-
-archive:
-       git tag $(GITTAG) refs/heads/master
-       @rm -rf /tmp/libefivar-$(VERSION) /tmp/libefivar-$(VERSION)-tmp
-       @mkdir -p /tmp/libefivar-$(VERSION)-tmp
-       @git archive --format=tar $(GITTAG) | ( cd /tmp/libefivar-$(VERSION)-tmp/ ; tar x )
-       @mv /tmp/libefivar-$(VERSION)-tmp/ /tmp/libefivar-$(VERSION)/
-       @dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/libefivar-$(VERSION).tar.bz2 libefivar-$(VERSION)
-       @rm -rf /tmp/libefivar-$(VERSION)
-       @echo "The archive is in libefivar-$(VERSION).tar.bz2"
+archive: abicheck bumpver abidw tag efivar.spec
+       @rm -rf /tmp/efivar-$(GITTAG) /tmp/efivar-$(GITTAG)-tmp
+       @mkdir -p /tmp/efivar-$(GITTAG)-tmp
+       @git archive --format=tar $(GITTAG) | ( cd /tmp/efivar-$(GITTAG)-tmp/ ; tar x )
+       @mv /tmp/efivar-$(GITTAG)-tmp/ /tmp/efivar-$(GITTAG)/
+       @cp efivar.spec /tmp/efivar-$(GITTAG)/
+       @dir=$$PWD; cd /tmp; tar -c --bzip2 -f $$dir/efivar-$(GITTAG).tar.bz2 efivar-$(GITTAG)
+       @rm -rf /tmp/efivar-$(GITTAG)
+       @echo "The archive is in efivar-$(GITTAG).tar.bz2"