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