--- iptables-1.3.1/Makefile
+++ iptables-1.3.1/Makefile
@@ -38,8 +38,10 @@
 CFLAGS += -DNO_SHARED_LIBS=1
 endif
 
-EXTRAS+=iptables iptables.o iptables.8
+EXTRAS+=iptables iptables.o iptables.8 libiptables.a
 EXTRA_INSTALLS+=$(DESTDIR)$(BINDIR)/iptables $(DESTDIR)$(MANDIR)/man8/iptables.8
+DEVEL_HEADERS+=include/iptables.h include/iptables_common.h
+DEVEL_LIBS+=libiptables.a
 
 # No longer experimental.
 ifneq ($(DO_MULTI), 1)
@@ -48,10 +50,12 @@
 EXTRA_INSTALLS+=$(DESTDIR)$(BINDIR)/iptables-save $(DESTDIR)$(BINDIR)/iptables-restore $(DESTDIR)$(MANDIR)/man8/iptables-restore.8 $(DESTDIR)$(MANDIR)/man8/iptables-save.8
 
 ifeq ($(DO_IPV6), 1)
-EXTRAS+=ip6tables ip6tables.o ip6tables.8
+EXTRAS+=ip6tables ip6tables.o ip6tables.8 libip6tables.a
 EXTRA_INSTALLS+=$(DESTDIR)$(BINDIR)/ip6tables $(DESTDIR)$(MANDIR)/man8/ip6tables.8
 EXTRAS+=ip6tables-save ip6tables-restore
 EXTRA_INSTALLS+=$(DESTDIR)$(BINDIR)/ip6tables-save $(DESTDIR)$(BINDIR)/ip6tables-restore # $(DESTDIR)$(MANDIR)/man8/iptables-restore.8 $(DESTDIR)$(MANDIR)/man8/iptables-save.8 $(DESTDIR)$(MANDIR)/man8/ip6tables-save.8 $(DESTDIR)$(MANDIR)/man8/ip6tables-restore.8
+DEVEL_HEADERS+=include/ip6tables.h
+DEVEL_LIBS+=libip6tables.a
 endif
 
 # Sparc64 hack
@@ -113,6 +117,8 @@
 print-extensions:
 	@[ -n "$(OPTIONALS)" ] && echo Extensions found: $(OPTIONALS)
 
+libiptables.a: libiptables.a(iptables.o)
+
 iptables.o: iptables.c
 	$(CC) $(CFLAGS) -DIPT_LIB_DIR=\"$(IPT_LIBDIR)\" -c -o $@ $<
 
@@ -154,6 +160,8 @@
 	cp $< $@
 endif
 
+libip6tables.a: libip6tables.a(ip6tables.o)
+
 ip6tables.o: ip6tables.c
 	$(CC) $(CFLAGS) -DIP6T_LIB_DIR=\"$(IPT_LIBDIR)\" -c -o $@ $<
 
@@ -202,7 +210,7 @@
 .PHONY: install-devel-headers
 install-devel-headers: $(DEVEL_HEADERS)
 	@[ -d $(DESTDIR)$(INCDIR) ] || mkdir -p $(DESTDIR)$(INCDIR)
-	@cp -v $(DEVEL_HEADERS) $(DESTDIR)$(INCDIR)
+	@cp -v --parents $(DEVEL_HEADERS) `echo $(DESTDIR)$(INCDIR) | sed  -e "s:/include/\?::"`
 
 .PHONY: install-devel-libs
 install-devel-libs: $(DEVEL_LIBS)
--- iptables-1.3.1/libipq/Makefile
+++ iptables-1.3.1/libipq/Makefile
@@ -17,7 +17,7 @@
 
 DEVEL_LIBS+=libipq/libipq.a
 
-DEVEL_HEADERS+=include/libipq/libipq.h
+DEVEL_HEADERS+=include/libipq/libipq.h include/libipq/ip_queue_64.h
 
 ifndef TOPLEVEL_INCLUDED
 local:
--- iptables-1.3.1/libiptc/Makefile
+++ iptables-1.3.1/libiptc/Makefile
@@ -16,8 +16,11 @@
 ifeq ($(DO_IPV6), 1)
 EXTRA_DEPENDS+= libiptc/libip6tc.d
 libiptc/libiptc.a: libiptc/libiptc.a(libiptc/libip6tc.o)
+DEVEL_HEADERS+=include/libiptc/libip6tc.h
 endif
 
+DEVEL_HEADERS+=include/libiptc/libiptc.h include/libiptc/ipt_kernel_headers.h
+
 libiptc/libip4tc.d libiptc/libip6tc.d: %.d: %.c
 	@-$(CC) -M -MG $(CFLAGS) $< | sed -e 's@^.*\.o:@$*.d libiptc/libiptc.a($*.o):@' > $@
 endif
