summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Mares <mj@ucw.cz>2008-02-17 23:27:16 +0100
committerMartin Mares <mj@ucw.cz>2008-02-17 23:27:16 +0100
commitbc46bc3902065d0209eb96fbe4d7dd92c2b534ee (patch)
treebfb8f323e57a683a9d5472894a75dd5f8d71492a
parent538a2423ae5a3af5ec26bb0b943df5b19c35dc9f (diff)
downloadpciutils-bc46bc3902065d0209eb96fbe4d7dd92c2b534ee.tar.gz
Moved the example program from lib/example.c to example.c.
Also, include it in the default targets, so that we always check that it builds correctly.
-rw-r--r--Makefile8
-rw-r--r--README2
-rw-r--r--example.c (renamed from lib/example.c)2
-rw-r--r--lib/Makefile2
4 files changed, 8 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 4624d72..ec46ba0 100644
--- a/Makefile
+++ b/Makefile
@@ -50,7 +50,7 @@ PCIINC_INS=lib/config.h lib/header.h lib/pci.h lib/types.h
export
-all: lib/$(PCILIB) lspci setpci lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS)
+all: lib/$(PCILIB) lspci setpci example lspci.8 setpci.8 pcilib.7 update-pciids update-pciids.8 $(PCI_IDS)
lib/$(PCILIB): $(PCIINC) force
$(MAKE) -C lib all
@@ -71,6 +71,10 @@ update-pciids: update-pciids.sh
sed <$< >$@ "s@^DEST=.*@DEST=$(IDSDIR)/$(PCI_IDS)@;s@^PCI_COMPRESSED_IDS=.*@PCI_COMPRESSED_IDS=$(PCI_COMPRESSED_IDS)@"
chmod +x $@
+# The example of use of libpci
+example: example.o lib/$(PCILIB)
+example.o: example.c $(PCIINC)
+
%: %.o
$(CC) $(LDFLAGS) $(TARGET_ARCH) $^ $(LDLIBS) -o $@
@@ -79,7 +83,7 @@ update-pciids: update-pciids.sh
clean:
rm -f `find . -name "*~" -o -name "*.[oa]" -o -name "\#*\#" -o -name TAGS -o -name core -o -name "*.orig"`
- rm -f update-pciids lspci setpci lib/config.* lib/example *.[78] pci.ids.* lib/*.pc lib/*.so lib/*.so.*
+ rm -f update-pciids lspci setpci example lib/config.* *.[78] pci.ids.* lib/*.pc lib/*.so lib/*.so.*
rm -rf maint/dist
distclean: clean
diff --git a/README b/README
index 8c354bf..577c46a 100644
--- a/README
+++ b/README
@@ -117,7 +117,7 @@ There is also a public GIT tree at:
So far, there is only a little documentation for the library except for the
general introduction in the pcilib(7) man page. If you want to use the
library in your programs, please follow the comments in lib/pci.h and in
-the example program lib/example.c.
+the example program example.c.
6. Feedback
diff --git a/lib/example.c b/example.c
index e7b5b66..c7e4e8a 100644
--- a/lib/example.c
+++ b/example.c
@@ -7,7 +7,7 @@
#include <stdio.h>
-#include "pci.h"
+#include "lib/pci.h"
int main(void)
{
diff --git a/lib/Makefile b/lib/Makefile
index 83f413e..76083f5 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -82,5 +82,3 @@ names-net.o: names-net.c $(INCL) names.h
names-parse.o: names-parse.c $(INCL) names.h
filter.o: filter.c $(INCL)
nbsd-libpci.o: nbsd-libpci.c $(INCL)
-
-example: example.c $(PCILIB)