Makefile 1.21 KB
Newer Older
Jordan Sissel's avatar
Jordan Sissel committed
1 2
VERSION=0.0.1

3 4
CFLAGS+=-Ibuild/include
#LDFLAGS+=-pthread
5
LDFLAGS=-Lbuild/lib -lzmq -rpath $$ORIGIN/build/lib
6

Jordan Sissel's avatar
Jordan Sissel committed
7 8
PREFIX?=/opt/lumberjack

Jordan Sissel's avatar
Jordan Sissel committed
9
default: build/bin/lumberjack
10 11
include Makefile.ext

Jordan Sissel's avatar
Jordan Sissel committed
12 13 14 15 16 17
clean:
	-rm -fr lumberjack unixsock *.o build

rpm deb:
	fpm -s dir -t $@ -n lumberjack -v $(VERSION) --prefix /opt/lumberjack \
		bin/lumberjack build/lib
18

Jordan Sissel's avatar
Jordan Sissel committed
19 20 21 22
#install: build/bin/lumberjack build/lib/libzmq.$(LIBEXT)
# install -d -m 755 build/bin/* $(PREFIX)/bin/lumberjack
# install -d build/lib/* $(PREFIX)/lib

Jordan Sissel's avatar
Jordan Sissel committed
23 24 25 26 27 28 29 30 31
#unixsock.c: build/include/insist.h
backoff.c: backoff.h
harvester.c: harvester.h
lumberjack.c: build/include/insist.h build/include/zeromq.h
lumberjack.c: backoff.h harvester.h

build/bin/lumberjack: | build/bin build/lib/libzmq.$(LIBEXT)
build/bin/lumberjack: lumberjack.o backoff.o harvester.o
	$(CC) -o $@ $^
Jordan Sissel's avatar
Jordan Sissel committed
32 33
	@echo " => Build complete: $@"
	@echo " => Run 'make rpm' to build an rpm (or deb or tarball)"
34

35 36 37 38

build/include/insist.h: | build/include
	curl -s -o $@ https://raw.github.com/jordansissel/experiments/master/c/better-assert/insist.h

39 40 41
build/include/zeromq.h build/lib/libzmq.$(LIBEXT): | build
	$(MAKE) -C vendor/zeromq/ PREFIX=$$PWD/build

42 43 44 45 46 47
build:
	mkdir $@

build/include: | build
	mkdir $@

Jordan Sissel's avatar
Jordan Sissel committed
48 49
build/bin: | build
	mkdir $@