2009-10-20 00:31:17 +00:00
|
|
|
#
|
|
|
|
# Copyright (c) 2009 Mark Heily <mark@heily.com>
|
|
|
|
#
|
|
|
|
# Permission to use, copy, modify, and distribute this software for any
|
|
|
|
# purpose with or without fee is hereby granted, provided that the above
|
|
|
|
# copyright notice and this permission notice appear in all copies.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
#
|
2009-11-08 02:04:16 +00:00
|
|
|
|
2009-11-07 20:29:41 +00:00
|
|
|
REPOSITORY=svn+ssh://mark.heily.com/$$HOME/svn/$(PROGRAM)
|
2009-11-07 21:13:59 +00:00
|
|
|
DIST=heily.com:$$HOME/public_html/$(PROGRAM)/dist
|
2009-11-26 06:09:44 +00:00
|
|
|
DISTFILE=$(PROGRAM)-$(VERSION).tar.gz
|
2009-10-20 00:31:17 +00:00
|
|
|
|
|
|
|
include config.mk
|
|
|
|
|
2010-02-03 01:33:55 +00:00
|
|
|
.PHONY :: install uninstall check dist dist-upload publish-www clean merge distclean fresh-build rpm edit cscope
|
2009-11-25 01:17:14 +00:00
|
|
|
|
2010-01-30 04:42:20 +00:00
|
|
|
all: $(PROGRAM).so $(PROGRAM).a
|
|
|
|
|
2009-11-25 01:04:27 +00:00
|
|
|
%.o: %.c $(DEPS)
|
2010-06-01 03:42:49 +00:00
|
|
|
$(CC) -c -o $@ -I./include -I./src/common $(CFLAGS) $<
|
2009-11-25 01:04:27 +00:00
|
|
|
|
2010-01-30 01:52:50 +00:00
|
|
|
$(PROGRAM).a: $(OBJS)
|
2009-11-25 00:28:12 +00:00
|
|
|
$(AR) rcs $(PROGRAM).a $(OBJS)
|
2010-01-30 01:52:50 +00:00
|
|
|
|
|
|
|
$(PROGRAM).so: $(OBJS)
|
2010-04-03 16:18:42 +00:00
|
|
|
$(LD) $(LDFLAGS) $(OBJS) $(LDADD)
|
|
|
|
$(LN) -sf $(PROGRAM).so.$(ABI_VERSION) $(PROGRAM).so
|
2009-10-20 00:31:17 +00:00
|
|
|
|
2009-11-25 00:28:12 +00:00
|
|
|
install: $(PROGRAM).so
|
2009-11-01 19:06:43 +00:00
|
|
|
$(INSTALL) -d -m 755 $(INCLUDEDIR)/kqueue/sys
|
2009-11-08 00:59:36 +00:00
|
|
|
$(INSTALL) -m 644 include/sys/event.h $(INCLUDEDIR)/kqueue/sys/event.h
|
2009-11-07 19:24:32 +00:00
|
|
|
$(INSTALL) -d -m 755 $(LIBDIR)
|
2010-04-03 16:18:42 +00:00
|
|
|
$(INSTALL) -m 644 $(PROGRAM).so.$(ABI_VERSION) $(LIBDIR)
|
|
|
|
$(LN) -sf $(PROGRAM).so.$(ABI_VERSION) $(LIBDIR)/$(PROGRAM).so.$(ABI_MAJOR)
|
|
|
|
$(LN) -sf $(PROGRAM).so.$(ABI_VERSION) $(LIBDIR)/$(PROGRAM).so
|
2009-11-26 06:09:44 +00:00
|
|
|
$(INSTALL) -m 644 $(PROGRAM).la $(LIBDIR)
|
|
|
|
$(INSTALL) -m 644 $(PROGRAM).a $(LIBDIR)
|
2009-11-06 00:18:53 +00:00
|
|
|
$(INSTALL) -d -m 755 $(LIBDIR)/pkgconfig
|
2009-11-01 19:06:43 +00:00
|
|
|
$(INSTALL) -m 644 libkqueue.pc $(LIBDIR)/pkgconfig
|
2009-11-06 00:18:53 +00:00
|
|
|
$(INSTALL) -d -m 755 $(MANDIR)/man2
|
2009-11-01 19:06:43 +00:00
|
|
|
$(INSTALL) -m 644 kqueue.2 $(MANDIR)/man2/kqueue.2
|
|
|
|
$(INSTALL) -m 644 kqueue.2 $(MANDIR)/man2/kevent.2
|
2009-10-20 00:31:17 +00:00
|
|
|
|
2009-11-01 17:48:45 +00:00
|
|
|
uninstall:
|
2009-11-01 19:06:43 +00:00
|
|
|
rm -f $(INCLUDEDIR)/kqueue/sys/event.h
|
|
|
|
rm -f $(LIBDIR)/libkqueue.so
|
|
|
|
rm -f $(LIBDIR)/pkgconfig/libkqueue.pc
|
|
|
|
rm -f $(MANDIR)/man2/kqueue.2
|
|
|
|
rm -f $(MANDIR)/man2/kevent.2
|
|
|
|
rmdir $(INCLUDEDIR)/kqueue/sys $(INCLUDEDIR)/kqueue
|
2009-11-01 17:48:45 +00:00
|
|
|
|
2010-01-30 01:52:50 +00:00
|
|
|
check: $(PROGRAM).a
|
2009-11-05 02:27:15 +00:00
|
|
|
cd test && ./configure && make check
|
2009-10-20 00:31:17 +00:00
|
|
|
|
2010-09-17 02:02:31 +00:00
|
|
|
debug-check: clean $(PROGRAM).a
|
|
|
|
cd test && ./configure && KQUEUE_DEBUG=y make check
|
|
|
|
|
2010-02-10 03:00:43 +00:00
|
|
|
$(DISTFILE): $(SOURCES) $(HEADERS)
|
2009-11-06 04:03:26 +00:00
|
|
|
mkdir $(PROGRAM)-$(VERSION)
|
2009-11-11 02:41:45 +00:00
|
|
|
cp Makefile ChangeLog configure config.inc \
|
|
|
|
$(MANS) $(EXTRA_DIST) \
|
2009-11-06 04:03:26 +00:00
|
|
|
$(PROGRAM)-$(VERSION)
|
|
|
|
cp -R $(SUBDIRS) $(PROGRAM)-$(VERSION)
|
2009-11-26 06:20:10 +00:00
|
|
|
rm -rf `find $(PROGRAM)-$(VERSION) -type d -name .svn -o -name .libs`
|
2010-02-10 03:06:47 +00:00
|
|
|
cd $(PROGRAM)-$(VERSION) && ./configure && cd test && ./configure && cd .. && make distclean
|
2009-11-06 04:03:26 +00:00
|
|
|
tar zcf $(PROGRAM)-$(VERSION).tar.gz $(PROGRAM)-$(VERSION)
|
|
|
|
rm -rf $(PROGRAM)-$(VERSION)
|
2009-10-20 00:31:17 +00:00
|
|
|
|
2009-11-26 06:09:44 +00:00
|
|
|
dist:
|
|
|
|
rm -f $(DISTFILE)
|
|
|
|
make $(DISTFILE)
|
|
|
|
|
2009-11-07 21:13:59 +00:00
|
|
|
dist-upload: dist
|
2009-11-08 02:04:16 +00:00
|
|
|
scp $(PROGRAM)-$(VERSION).tar.gz $(DIST)
|
2009-11-07 21:13:59 +00:00
|
|
|
|
2009-10-20 00:31:17 +00:00
|
|
|
clean:
|
2010-06-09 03:25:20 +00:00
|
|
|
rm -f tags *.a $(OBJS) *.so *.so.*
|
|
|
|
rm -rf pkg
|
2009-12-14 00:13:10 +00:00
|
|
|
cd test && make clean || true
|
2009-10-20 00:31:17 +00:00
|
|
|
|
2010-06-09 03:25:20 +00:00
|
|
|
distclean: clean
|
|
|
|
rm -f *.tar.gz config.mk config.h $(PROGRAM).pc $(PROGRAM).la rpm.spec
|
|
|
|
rm -rf $(PROGRAM)-$(VERSION) 2>/dev/null || true
|
|
|
|
|
2009-11-25 01:09:55 +00:00
|
|
|
fresh-build:
|
|
|
|
rm -rf /tmp/$(PROGRAM)-testbuild
|
|
|
|
svn co svn://mark.heily.com/libkqueue/trunk /tmp/$(PROGRAM)-testbuild
|
|
|
|
cd /tmp/$(PROGRAM)-testbuild && ./configure && make check
|
|
|
|
rm -rf /tmp/$(PROGRAM)-testbuild
|
|
|
|
|
2009-11-07 20:29:41 +00:00
|
|
|
merge:
|
|
|
|
svn diff $(REPOSITORY)/branches/stable $(REPOSITORY)/trunk | gvim -
|
|
|
|
@printf "Merge changes from the trunk to the stable branch [y/N]? "
|
|
|
|
@read x && test "$$x" = "y"
|
2009-11-07 21:02:10 +00:00
|
|
|
echo "ok"
|
2009-11-07 20:29:41 +00:00
|
|
|
|
2010-02-10 01:32:49 +00:00
|
|
|
tags: $(SOURCES) $(HEADERS)
|
2010-02-08 03:09:57 +00:00
|
|
|
ctags $(SOURCES) $(HEADERS)
|
2010-02-10 01:32:49 +00:00
|
|
|
|
|
|
|
edit: tags
|
|
|
|
$(EDITOR) $(SOURCES) $(HEADERS)
|
2010-01-24 23:39:45 +00:00
|
|
|
|
2010-02-10 01:32:49 +00:00
|
|
|
cscope: tags
|
2010-02-08 03:09:57 +00:00
|
|
|
cscope $(SOURCES) $(HEADERS)
|
2010-02-03 01:33:55 +00:00
|
|
|
|
2010-09-15 02:50:30 +00:00
|
|
|
# Creates an ~/rpmbuild tree
|
|
|
|
rpmbuild:
|
2010-09-17 02:02:31 +00:00
|
|
|
mkdir -p $$HOME/rpmbuild
|
|
|
|
cd $$HOME/rpmbuild && mkdir -p BUILD RPMS SOURCES SPECS SRPMS
|
2010-09-15 02:50:30 +00:00
|
|
|
grep _topdir $$HOME/.rpmmacros || \
|
|
|
|
echo "%_topdir %(echo $$HOME/rpmbuild)" >> $$HOME/.rpmmacros
|
|
|
|
|
|
|
|
rpm: rpmbuild clean $(DISTFILE)
|
2010-09-15 02:24:34 +00:00
|
|
|
mkdir -p pkg
|
2010-09-15 02:50:30 +00:00
|
|
|
cp $(DISTFILE) $$HOME/rpmbuild/SOURCES
|
|
|
|
rpmbuild -bb rpm.spec
|
|
|
|
find $$HOME/rpmbuild -name '$(PROGRAM)-$(VERSION)*.rpm' -exec mv {} ./pkg \;
|
2009-11-26 06:09:44 +00:00
|
|
|
|
2010-03-28 00:29:59 +00:00
|
|
|
deb: clean $(DISTFILE)
|
2010-06-09 03:25:20 +00:00
|
|
|
mkdir pkg && cd pkg ; \
|
|
|
|
tar zxf ../$(DISTFILE) ; \
|
|
|
|
cp ../$(DISTFILE) $(PROGRAM)_$(VERSION).orig.tar.gz ; \
|
|
|
|
cp -R ../ports/debian $(PROGRAM)-$(VERSION) ; \
|
2010-06-09 03:48:14 +00:00
|
|
|
rm -rf `find $(PROGRAM)-$(VERSION)/debian -type d -name .svn` ; \
|
2010-06-09 03:41:18 +00:00
|
|
|
perl -pi -e 's/\@\@VERSION\@\@/$(VERSION)/' $(PROGRAM)-$(VERSION)/debian/changelog ; \
|
2010-06-09 03:25:20 +00:00
|
|
|
cd $(PROGRAM)-$(VERSION) && dpkg-buildpackage -uc -us
|
2010-06-09 03:28:23 +00:00
|
|
|
lintian -i pkg/*.deb
|
|
|
|
@printf "\nThe following packages have been created:\n"
|
|
|
|
@find ./pkg -name '*.deb' | sed 's/^/ /'
|
2010-03-28 00:29:59 +00:00
|
|
|
|
2009-12-20 05:39:39 +00:00
|
|
|
debug-install:
|
|
|
|
./configure --prefix=/usr --debug=yes
|
|
|
|
make clean && make && sudo make install
|
2010-01-30 05:11:40 +00:00
|
|
|
|
|
|
|
diff:
|
|
|
|
if [ "`pwd | grep /trunk`" != "" ] ; then \
|
|
|
|
(cd .. ; $(DIFF) branches/stable trunk | less) ; \
|
|
|
|
fi
|
|
|
|
if [ "`pwd | grep /branches/stable`" != "" ] ; then \
|
|
|
|
(cd ../.. ; $(DIFF) branches/stable trunk | less) ; \
|
|
|
|
fi
|
2010-08-25 23:44:52 +00:00
|
|
|
|
|
|
|
# Copy to/from the host to the Solaris guest VM
|
|
|
|
#
|
|
|
|
solaris-push:
|
2010-08-26 00:32:09 +00:00
|
|
|
ssh -p 2222 localhost 'rm -rf /export/home/mheily/libkqueue'
|
2010-08-25 23:44:52 +00:00
|
|
|
cd .. ; scp -rq -P 2222 trunk localhost:/export/home/mheily/libkqueue
|
|
|
|
|
2010-08-26 00:32:09 +00:00
|
|
|
solaris-test: solaris-push
|
|
|
|
ssh -p 2222 localhost 'cd /export/home/mheily/libkqueue && /usr/sfw/bin/gmake distclean && ./configure && /usr/sfw/bin/gmake clean all check'
|
|
|
|
|
2010-08-25 23:44:52 +00:00
|
|
|
solaris-pull:
|
|
|
|
scp -rq -P 2222 localhost:/export/home/mheily/libkqueue/\* .
|
2010-08-26 00:32:09 +00:00
|
|
|
#
|
|
|
|
#
|