Makefile 1.68 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
LDFLAGS+=-pthread
5
LDFLAGS+=-Lbuild/lib -Wl,-rpath,'$$ORIGIN/../lib'
Jordan Sissel's avatar
Jordan Sissel committed
6
LIBS=-lzmq -ljansson
7

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

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

Jordan Sissel's avatar
Jordan Sissel committed
13 14
clean:
	-rm -fr lumberjack unixsock *.o build
Jordan Sissel's avatar
Jordan Sissel committed
15
	-#make -C vendor/jansson/ clean
Jordan Sissel's avatar
Jordan Sissel committed
16
	-make -C vendor/zeromq/ clean
Jordan Sissel's avatar
Jordan Sissel committed
17 18 19 20

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

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

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

39 40 41 42

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

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

Jordan Sissel's avatar
Jordan Sissel committed
46 47 48 49 50
#build/include/msgpack.h build/lib/libmsgpack.$(LIBEXT): | build
#	$(MAKE) -C vendor/msgpack/ install PREFIX=$$PWD/build

build/include/jansson.h build/lib/libjansson.$(LIBEXT): | build
	$(MAKE) -C vendor/jansson/ install PREFIX=$$PWD/build
51

52 53 54 55 56 57
build:
	mkdir $@

build/include: | build
	mkdir $@

Jordan Sissel's avatar
Jordan Sissel committed
58 59
build/bin: | build
	mkdir $@