Commit 66dfb9b5 authored by Jordan Sissel's avatar Jordan Sissel

- make it compile under linux/gcc (prior was OSX/clang)

parent 49f32598
VERSION=0.0.1
CFLAGS+=-Ibuild/include
#LDFLAGS+=-pthread
LDFLAGS=-Lbuild/lib -lzmq -rpath $$ORIGIN/build/lib
CFLAGS+=-Ibuild/include -std=c99 -Wall -pipe -O2
LDFLAGS+=-pthread
LDFLAGS+=-Lbuild/lib -Wl,-rpath='$$ORIGIN/../lib'
LIBS=-lzmq
PREFIX?=/opt/lumberjack
......@@ -28,7 +29,7 @@ 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 $@ $^
$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
@echo " => Build complete: $@"
@echo " => Run 'make rpm' to build an rpm (or deb or tarball)"
......
#include "backoff.h"
#define _XOPEN_SOURCE 500 /* for useconds_t */
#include <stdio.h>
#include <unistd.h>
#include "backoff.h"
inline void backoff_init(struct backoff *b, useconds_t min, useconds_t max) {
b->max = max;
......
#ifndef _BACKOFF_H_
#define _BACKOFF_H_
#define _XOPEN_SOURCE 500 /* for useconds_t */
#include <sys/types.h>
#include <unistd.h>
struct backoff {
useconds_t max;
......
#define _XOPEN_SOURCE 500 /* for useconds_t */
#include "harvester.h"
#include <string.h> /* for strerror(3) */
#include <errno.h> /* for errno */
......
#define _BSD_SOURCE /* to get gethostname() under linux/gcc */
#include <sys/types.h>
#include <getopt.h>
#include <insist.h>
#include <pthread.h>
......@@ -33,12 +35,12 @@ int main(int argc, char **argv) {
pthread_t *harvesters = calloc(argc, sizeof(pthread_t));
/* Start harvesters for each path given */
for (int i = 0; i < argc; i++) {
for (i = 0; i < argc; i++) {
pthread_create(&harvesters[i], NULL, harvest, argv[i]);
}
/* Wait for the harvesters to die */
for (int i = 0; i < argc; i++) {
for (i = 0; i < argc; i++) {
pthread_join(harvesters[i], NULL);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment