blob: cca70ba798704156aa25e93c9b1d9f13cbaf0b4e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
From 7b30e567552535d9546e34d4fc38337095347224 Mon Sep 17 00:00:00 2001
From: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
Date: Tue, 13 Sep 2016 15:51:55 +0300
Subject: [PATCH 2/2] fix cross-compile
Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com>
---
Makefile | 19 ++++++++++---------
reader.cpp | 1 +
2 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/Makefile b/Makefile
index 02d25c7..9bbe82e 100644
--- a/Makefile
+++ b/Makefile
@@ -1,14 +1,15 @@
-prefix = /usr/local
-bindir = $(prefix)/bin
-CXX = g++
-CC = gcc
-CFLAGS = -Wall -pthread
-LDFLAGS = -g -pthread
+PREFIX ?= /usr
+SBINDIR ?= $(PREFIX)/bin
+CXX ?= g++
+CC ?= gcc
+CFLAGS += -Wall -pthread
+LDFLAGS += -g
+LIBS = -lpthread
SOURCES = main.cpp reader.cpp write.cpp showev.cpp
ifneq ($(inotify),no)
- CFLAGS += -DWITH_INOTIFY
+ GCC_FLAGS += -DWITH_INOTIFY
endif
all: build netevent devname
@@ -23,13 +24,13 @@ build/%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $*.c -MMD -MF build/$*.d -MT $@
netevent: $(patsubst %.cpp,build/%.o,$(SOURCES))
- $(CXX) $(LDFLAGS) -o $@ $^
+ $(CXX) $(LDFLAGS) -o $@ $^ $(LIBS)
devname: build/devname.o
$(CC) -o $@ $^
install: all
- install -m 755 -p -t "$(DESTDIR)$(bindir)" netevent devname
+ install -m 755 -p -t "$(DESTDIR)$(SBINDIR)" netevent devname
clean:
-rm -rf build
diff --git a/reader.cpp b/reader.cpp
index 651967a..07fa64a 100644
--- a/reader.cpp
+++ b/reader.cpp
@@ -6,6 +6,7 @@
#include <arpa/inet.h>
#include <stdint.h>
#include <unistd.h>
+#include <pthread.h>
int64_t htonll(int64_t value){
int num = 42;
--
1.7.10.4
|