-lspci.o: lspci.c pciutils.h
-names.o: names.c pciutils.h
-filter.o: filter.c pciutils.h
-setpci.o: setpci.c pciutils.h
+HOST=
+RELEASE=
+
+export
+
+all: $(PCILIB) lspci setpci lspci.8 setpci.8 update-pciids update-pciids.8 pci.ids
+
+$(PCILIB): $(PCIINC) force
+ $(MAKE) -C lib all
+
+force:
+
+lib/config.h:
+ cd lib && ./configure $(SHAREDIR) $(VERSION) $(HOST) $(RELEASE)
+
+lspci: lspci.o common.o $(PCILIB)
+setpci: setpci.o common.o $(PCILIB)
+
+lspci.o: lspci.c pciutils.h $(PCIINC)
+setpci.o: setpci.c pciutils.h $(PCIINC)
+common.o: common.c pciutils.h $(PCIINC)
+
+update-pciids: update-pciids.sh
+ sed <$< >$@ "s@^DEST=.*@DEST=$(SHAREDIR)/pci.ids@"
+
+%.8: %.man
+ M=`echo $(DATE) | sed 's/-01-/-January-/;s/-02-/-February-/;s/-03-/-March-/;s/-04-/-April-/;s/-05-/-May-/;s/-06-/-June-/;s/-07-/-July-/;s/-08-/-August-/;s/-09-/-September-/;s/-10-/-October-/;s/-11-/-November-/;s/-12-/-December-/;s/\(.*\)-\(.*\)-\(.*\)/\3 \2 \1/'` ; sed <$< >$@ "s/@TODAY@/$$M/;s/@VERSION@/pciutils-$(VERSION)/;s#@SHAREDIR@#$(SHAREDIR)#"