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-01-24 23:39:45 +00:00
|
|
|
.PHONY :: install uninstall check dist dist-upload publish-www clean merge distclean fresh-build rpm edit
|
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)
|
|
|
|
$(CC) -c -o $@ $(CFLAGS) $<
|
|
|
|
|
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)
|
2009-11-25 00:28:12 +00:00
|
|
|
$(LD) $(LDFLAGS) -o $(PROGRAM).so $(OBJS) $(LDADD)
|
2009-10-20 00:31:17 +00:00
|
|
|
|
2009-12-26 00:08:11 +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)
|
2009-11-26 06:09:44 +00:00
|
|
|
$(INSTALL) -m 644 $(PROGRAM).so $(LIBDIR)
|
|
|
|
$(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
|
|
|
|
2009-11-26 06:09:44 +00:00
|
|
|
$(DISTFILE): $(OBJS)
|
2009-11-07 21:13:59 +00:00
|
|
|
cd test && make distclean || true
|
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`
|
2009-11-26 06:09:44 +00:00
|
|
|
cd $(PROGRAM)-$(VERSION) && rm $(OBJS)
|
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 02:08:04 +00:00
|
|
|
publish-www:
|
2009-11-06 04:09:31 +00:00
|
|
|
rm ~/public_html/libkqueue/*.html ; cp -R www/*.html ~/public_html/libkqueue/
|
2009-10-20 02:08:04 +00:00
|
|
|
|
2009-10-20 00:31:17 +00:00
|
|
|
clean:
|
2009-11-25 01:37:14 +00:00
|
|
|
rm -f *.a $(OBJS) *.so
|
2009-12-14 00:13:10 +00:00
|
|
|
cd test && make clean || true
|
2009-10-20 00:31:17 +00:00
|
|
|
|
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-01-24 23:39:45 +00:00
|
|
|
edit:
|
|
|
|
$(EDITOR) `find src/common -name '*.c' -o -name '*.h'` \
|
|
|
|
`find src/$(TARGET) -name '*.c'`
|
|
|
|
|
2009-10-20 00:31:17 +00:00
|
|
|
distclean: clean
|
2009-11-25 01:37:14 +00:00
|
|
|
rm -f *.tar.gz config.mk config.h $(PROGRAM).pc $(PROGRAM).la rpm.spec
|
2009-11-26 06:09:44 +00:00
|
|
|
|
2009-11-26 06:20:10 +00:00
|
|
|
rpm: clean $(DISTFILE)
|
2009-11-26 06:09:44 +00:00
|
|
|
rm -rf rpm *.rpm *.deb
|
|
|
|
mkdir -p rpm/BUILD rpm/RPMS rpm/SOURCES rpm/SPECS rpm/SRPMS
|
|
|
|
mkdir -p rpm/RPMS/i386 rpm/RPMS/x86_64
|
|
|
|
cp $(DISTFILE) rpm/SOURCES
|
|
|
|
rpmbuild -bb rpm.spec
|
|
|
|
mv ./rpm/RPMS/* .
|
|
|
|
rm -rf rpm
|
2009-11-26 06:20:10 +00:00
|
|
|
rmdir i386 x86_64 # WORKAROUND: These aren't supposed to exist
|
2009-11-26 06:09:44 +00:00
|
|
|
fakeroot alien --scripts *.rpm
|
|
|
|
|
2009-12-20 05:39:39 +00:00
|
|
|
debug-install:
|
|
|
|
./configure --prefix=/usr --debug=yes
|
|
|
|
make clean && make && sudo make install
|