| 1 |
# makefile |
| 2 |
|
| 3 |
include ../config.mak |
| 4 |
|
| 5 |
VERSION = 0.2 |
| 6 |
|
| 7 |
ifeq ($(TARGET_OS),CYGWIN) |
| 8 |
SHORTNAME = libdha.dll |
| 9 |
else |
| 10 |
SHORTNAME = libdha.so |
| 11 |
endif |
| 12 |
LIBNAME = libdha-$(VERSION).so |
| 13 |
|
| 14 |
SRCS=libdha.c mtrr.c pci.c pci_names.c mmi.c ports.c |
| 15 |
OBJS=$(SRCS:.c=.o) |
| 16 |
|
| 17 |
CFLAGS = $(OPTFLAGS) -fPIC -I. -I.. -Wall -W |
| 18 |
LIBS = |
| 19 |
ifeq ($(TARGET_OS),OpenBSD) |
| 20 |
ifeq ($(TARGET_ARCH_X86),yes) |
| 21 |
LIBS += -li386 |
| 22 |
endif |
| 23 |
endif |
| 24 |
|
| 25 |
.SUFFIXES: .c .o |
| 26 |
|
| 27 |
# .PHONY: all clean |
| 28 |
|
| 29 |
.c.o: |
| 30 |
$(CC) -c $(CFLAGS) -o $@ $< |
| 31 |
|
| 32 |
$(LIBNAME): $(OBJS) |
| 33 |
$(CC) -shared -o $(LIBNAME) $(OBJS) $(LIBS) |
| 34 |
ln -sf $(LIBNAME) $(SHORTNAME) |
| 35 |
|
| 36 |
all: $(LIBNAME) $(SHORTNAME) |
| 37 |
|
| 38 |
pci_names.c: |
| 39 |
$(AWK) -f pci_db2c.awk oth/pci.db |
| 40 |
|
| 41 |
test: |
| 42 |
$(CC) test.c -o test $(SHORTNAME) |
| 43 |
|
| 44 |
clean: |
| 45 |
rm -f *.o *.so *~ |
| 46 |
|
| 47 |
distclean: |
| 48 |
rm -f Makefile.bak *.o *.so test *~ .depend |
| 49 |
rm -f pci_dev_ids.c pci_ids.h pci_names.c pci_names.h pci_vendors.h pci.db |
| 50 |
|
| 51 |
dep: depend |
| 52 |
|
| 53 |
depend: |
| 54 |
$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend |
| 55 |
|
| 56 |
install: |
| 57 |
install -D -m 755 -s -p $(LIBNAME) $(prefix)/lib/$(LIBNAME) |
| 58 |
rm -f $(prefix)/lib/libdha.so |
| 59 |
ln -sf $(LIBNAME) $(prefix)/lib/libdha.so |
| 60 |
ifeq ($(TARGET_OS),OpenBSD) |
| 61 |
$(LDCONFIG) -R |
| 62 |
else |
| 63 |
$(LDCONFIG) |
| 64 |
endif |
| 65 |
uninstall: |
| 66 |
rm -f $(prefix)/lib/$(LIBNAME) |
| 67 |
rm -f $(prefix)/lib/libdha.so |
| 68 |
rmdir -p --ignore-fail-on-non-empty $(prefix)/lib |
| 69 |
# |
| 70 |
# include dependency files if they exist |
| 71 |
# |
| 72 |
ifneq ($(wildcard .depend),) |
| 73 |
include .depend |
| 74 |
endif |