3973
|
1 # makefile
|
|
2
|
|
3 include ../config.mak
|
|
4
|
|
5 VERSION = 0.1
|
|
6
|
|
7 SHORTNAME = libdha.so
|
|
8 LIBNAME = libdha-$(VERSION).so
|
|
9
|
4106
|
10 SRCS=libdha.c pci.c pci_names.c
|
3973
|
11 OBJS=$(SRCS:.c=.o)
|
|
12
|
|
13 CFLAGS = $(OPTFLAGS) -fPIC -I. -I.. -Wall -W
|
|
14
|
|
15 .SUFFIXES: .c .o
|
|
16
|
|
17 # .PHONY: all clean
|
|
18
|
|
19 .c.o:
|
|
20 $(CC) -c $(CFLAGS) -o $@ $<
|
|
21
|
|
22 $(LIBNAME): $(OBJS)
|
|
23 $(CC) -shared -o $(LIBNAME) $(OBJS)
|
|
24 ln -sf $(LIBNAME) $(SHORTNAME)
|
|
25
|
|
26 all: $(LIBNAME) $(SHORTNAME)
|
|
27
|
4106
|
28 pci_names.c:
|
|
29 gzip -d -c oth/pci.db.gz >pci.db
|
4110
|
30 awk -f pci_db2c.awk pci.db
|
4106
|
31
|
3973
|
32 test:
|
|
33 $(CC) test.c -o test $(SHORTNAME)
|
|
34
|
|
35 clean:
|
|
36 rm -f *.o *.so *~
|
|
37
|
|
38 distclean:
|
|
39 rm -f Makefile.bak *.o *.so test *~ .depend
|
4106
|
40 rm -f pci_dev_ids.c pci_ids.h pci_names.c pci_names.h pci_vendors.h pci.db
|
3973
|
41
|
|
42 dep: depend
|
|
43
|
|
44 depend:
|
|
45 $(CC) -MM $(CFLAGS) $(SRCS) 1>.depend
|
|
46
|
|
47 install:
|
|
48 cp $(LIBNAME) $(prefix)/lib/$(LIBNAME)
|
4030
|
49 rm -f $(prefix)/lib/libdha.so
|
3973
|
50 ln -sf $(LIBNAME) $(prefix)/lib/libdha.so
|
|
51 ldconfig
|
|
52
|
|
53 #
|
|
54 # include dependency files if they exist
|
|
55 #
|
|
56 ifneq ($(wildcard .depend),)
|
|
57 include .depend
|
|
58 endif
|