| 1 |
ARPTABLES_VERSION:=0.0.5 |
| 2 |
|
| 3 |
KERNEL_DIR:=./ |
| 4 |
# default paths |
| 5 |
PREFIX:=/usr/local |
| 6 |
LIBDIR:=$(PREFIX)/lib |
| 7 |
BINDIR:=$(PREFIX)/sbin |
| 8 |
MANDIR:=$(PREFIX)/man |
| 9 |
man8dir=$(MANDIR)/man8 |
| 10 |
SYSCONFIGDIR:=/etc/sysconfig |
| 11 |
DESTDIR:= |
| 12 |
|
| 13 |
MANS = arptables-legacy.8 arptables-save.8 arptables-restore.8 |
| 14 |
|
| 15 |
COPT_FLAGS:=-O2 |
| 16 |
CFLAGS:=$(COPT_FLAGS) -Wall -Wunused -I$(KERNEL_DIR)/include/ -Iinclude/ -DARPTABLES_VERSION=\"$(ARPTABLES_VERSION)\" #-g -DDEBUG #-pg # -DARPTC_DEBUG |
| 17 |
|
| 18 |
ifndef ARPT_LIBDIR |
| 19 |
ARPT_LIBDIR:=$(LIBDIR)/arptables |
| 20 |
endif |
| 21 |
|
| 22 |
include extensions/Makefile |
| 23 |
|
| 24 |
all: arptables-legacy libarptc/libarptc.a |
| 25 |
|
| 26 |
arptables.o: arptables.c |
| 27 |
$(CC) $(CFLAGS) -c -o $@ $< |
| 28 |
|
| 29 |
arptables-standalone.o: arptables-standalone.c |
| 30 |
$(CC) $(CFLAGS) -c -o $@ $< |
| 31 |
|
| 32 |
libarptc/libarptc.o: libarptc/libarptc.c libarptc/libarptc_incl.c |
| 33 |
$(CC) $(CFLAGS) -c -o $@ $< |
| 34 |
|
| 35 |
libarptc/libarptc.a: libarptc/libarptc.o |
| 36 |
$(AR) rcs $@ $< |
| 37 |
|
| 38 |
arptables-legacy: arptables-standalone.o arptables.o libarptc/libarptc.o $(EXT_OBJS) |
| 39 |
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ |
| 40 |
|
| 41 |
$(DESTDIR)$(BINDIR)/arptables-legacy: arptables-legacy |
| 42 |
mkdir -p $(DESTDIR)$(BINDIR) |
| 43 |
install -m 0755 $< $@ |
| 44 |
|
| 45 |
tmp1:=$(shell printf $(BINDIR) | sed 's/\//\\\//g') |
| 46 |
tmp2:=$(shell printf $(SYSCONFIGDIR) | sed 's/\//\\\//g') |
| 47 |
.PHONY: scripts |
| 48 |
scripts: arptables-save arptables-restore |
| 49 |
cat arptables-save | sed 's/__EXEC_PATH__/$(tmp1)/g' > arptables-save_ |
| 50 |
install -m 0755 arptables-save_ $(DESTDIR)$(BINDIR)/arptables-legacy-save |
| 51 |
cat arptables-restore | sed 's/__EXEC_PATH__/$(tmp1)/g' > arptables-restore_ |
| 52 |
install -m 0755 arptables-restore_ $(DESTDIR)$(BINDIR)/arptables-legacy-restore |
| 53 |
rm -f arptables-save_ arptables-restore_ |
| 54 |
|
| 55 |
.PHONY: install-man |
| 56 |
install-man: $(MANS) |
| 57 |
[ -d "$(DESTDIR)$(man8dir)" ] || mkdir -p "$(DESTDIR)$(man8dir)" |
| 58 |
install -m 0644 $^ $(DESTDIR)$(man8dir)/ |
| 59 |
|
| 60 |
.PHONY: install |
| 61 |
install: install-man $(DESTDIR)$(BINDIR)/arptables-legacy scripts |
| 62 |
|
| 63 |
.PHONY: clean |
| 64 |
clean: |
| 65 |
rm -f arptables-legacy |
| 66 |
rm -f *.o *~ |
| 67 |
rm -f extensions/*.o extensions/*~ |
| 68 |
rm -f libarptc/*.o libarptc/*~ libarptc/*.a |
| 69 |
rm -f include/*~ include/libarptc/*~ |
| 70 |
|
| 71 |
DIR:=arptables-v$(ARPTABLES_VERSION) |
| 72 |
# This is used to make a new userspace release |
| 73 |
.PHONY: release |
| 74 |
release: |
| 75 |
make clean |
| 76 |
cd ..;find $(DIR) -exec touch {} \;;find $(DIR) -exec chmod o-r,g-r,o-w,g-w,o-x,g-x {} \;;tar -pc $(DIR) | gzip >$(DIR).tar.gz |
| 77 |
|