Permalink
Browse files

Builds on Darwin, aka OS X.

  • Loading branch information...
1 parent 35db242 commit e98575a606036a117c91e00debc48dd426235dcf @sam-github committed Feb 12, 2010
Showing with 30 additions and 17 deletions.
  1. +1 −2 Stow
  2. +6 −0 lua/Darwin.mak
  3. +7 −0 lua/Linux.mak
  4. +13 −15 lua/Makefile
  5. +3 −0 lua/T
View
3 Stow
@@ -1,10 +1,9 @@
#!/bin/sh
-set -v
+set -x
set -e
(cd /usr/local/stow && sudo stow -D libnet)
-find /usr/local -name libnet\* | grep -v /usr/local/stow/libnet
sudo rm -rf /usr/local/stow/libnet
sudo mkdir -p /usr/local/stow/libnet
View
@@ -0,0 +1,6 @@
+# OS X
+CC = MACOSX_DEPLOYMENT_TARGET="10.3" gcc
+LDFLAGS = -fno-common -bundle -undefined dynamic_lookup
+CLUA=-I/usr/local/include
+LLUA=-llua
+
View
@@ -0,0 +1,7 @@
+# Linux
+CC = gcc
+LDFLAGS = -fPIC -fno-common -shared
+BINDING += nfq.so
+CLUA=-I/usr/include/lua5.1
+LLUA=-llua5.1
+
View
@@ -4,16 +4,9 @@ default: build
BINDING=net.so pcap.so
-# OS X
-CC = MACOSX_DEPLOYMENT_TARGET="10.3" gcc
-LDFLAGS = -fno-common -bundle -undefined dynamic_lookup
+UNAME=$(shell uname)
-# Linux
-CC = gcc
-LDFLAGS = -fPIC -fno-common -shared
-
-
-BINDING += nfq.so
+include $(UNAME).mak
build: $(BINDING)
@@ -24,7 +17,7 @@ SODIR = $(DESTDIR)$(prefix)/lib/lua/5.1/
.PHONY: install
install: $(BINDING)
mkdir -p $(SODIR)
- install -t $(SODIR) $(BINDING)
+ ../libnet/install-sh -t $(SODIR) $(BINDING)
.PHONY: net pcap nfq
@@ -52,20 +45,25 @@ CWARNS = -Wall \
-Wshadow \
-Wwrite-strings
-CDEFS=`sh ../libnet/libnet-config --cflags --defines` `dnet-config --cflags`
+CDEFS=$(shell sh ../libnet/libnet-config --cflags --defines) $(shell dnet-config --cflags)
COPT=-O2 -DNDEBUG -g
-CLUA=-I/usr/include/lua5.1
CFLAGS=$(CWARNS) $(CDEFS) $(CLUA) $(LDFLAGS) -I../libnet/include -L../libnet/src/.libs/
-LDLIBS=`dnet-config --libs` `sh ../libnet/libnet-config --libs` -llua5.1
+LDLIBS=$(LLUA)
+
+LDDNET=$(shell dnet-config --libs)
+LDLNET=$(shell sh ../libnet/libnet-config --libs)
CC.SO := $(CC) $(COPT) $(CFLAGS)
%.so: %.c
- $(CC.SO) -o $@ $< $(LDLIBS)
+ $(CC.SO) -o $@ $^ $(LDLIBS)
+
+net.so: net.c libnet_decode.c
+net.so: LDLIBS+=$(LDDNET) $(LDLNET)
-net.so: net.c
pcap.so: pcap.c
pcap.so: LDLIBS+=-lpcap
+
nfq.so: nfq.c
nfq.so: LDLIBS+=-lnetfilter_queue
View
3 lua/T
@@ -1,4 +1,7 @@
#!/bin/sh
+set -e
+set -x
+
~/bin/T . ../libnet/include ../libnet/src

0 comments on commit e98575a

Please sign in to comment.