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

3
CFLAGS+=-Ibuild/include -std=c99 -Wall -Wextra -Werror -pipe -g 
4
#-O2
5
LDFLAGS+=-pthread
6
LDFLAGS+=-Lbuild/lib -Wl,-rpath,'$$ORIGIN/../lib'
7
LIBS=-lzmq
8

Jordan Sissel's avatar
Jordan Sissel committed
9 10
PREFIX?=/opt/lumberjack

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

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

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

Jordan Sissel's avatar
Jordan Sissel committed
21 22 23 24
#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
25 26 27
#unixsock.c: build/include/insist.h
backoff.c: backoff.h
harvester.c: harvester.h
28
emitter.c: emitter.h
Jordan Sissel's avatar
Jordan Sissel committed
29
lumberjack.c: build/include/insist.h build/include/zeromq.h
30
lumberjack.c: backoff.h harvester.h emitter.h
Jordan Sissel's avatar
Jordan Sissel committed
31 32

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

38 39 40 41

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

42 43 44
build/include/zeromq.h build/lib/libzmq.$(LIBEXT): | build
	$(MAKE) -C vendor/zeromq/ PREFIX=$$PWD/build

45 46 47 48 49 50
build:
	mkdir $@

build/include: | build
	mkdir $@

Jordan Sissel's avatar
Jordan Sissel committed
51 52
build/bin: | build
	mkdir $@