shared libraries need fPIC
diff --git a/Makefile b/Makefile
index 6ddfdc9..a05ce17 100644
--- a/Makefile
+++ b/Makefile
@@ -23,6 +23,7 @@
CFLAGS:=-Wall -Wunused
+CFLAGS_SH_LIB:=-fPIC
CC:=gcc
LD:=ld
@@ -72,16 +73,16 @@
all: ebtables ebtables-restore
communication.o: communication.c include/ebtables_u.h
- $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
+ $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
libebtc.o: libebtc.c include/ebtables_u.h
- $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
+ $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
useful_functions.o: useful_functions.c include/ebtables_u.h
- $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
+ $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
getethertype.o: getethertype.c include/ethernetdb.h
- $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -Iinclude/
+ $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -Iinclude/
ebtables.o: ebtables.c include/ebtables_u.h
$(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
diff --git a/extensions/Makefile b/extensions/Makefile
index 2976d62..731f5fa 100644
--- a/extensions/Makefile
+++ b/extensions/Makefile
@@ -23,8 +23,8 @@
mv $< $@
extensions/ebt_%.o: extensions/ebt_%.c include/ebtables_u.h
- $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
+ $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
extensions/ebtable_%.o: extensions/ebtable_%.c
- $(CC) $(CFLAGS) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)
+ $(CC) $(CFLAGS) $(CFLAGS_SH_LIB) $(PROGSPECS) -c -o $@ $< -I$(KERNEL_INCLUDES)