| 1 |
LIBNAME = libvidix.so |
| 2 |
BINDIR = $(prefix)/lib |
| 3 |
INCDIR = $(prefix)/include/vidix |
| 4 |
SUBDIRS = drivers |
| 5 |
DO_MAKE = @ for i in $(SUBDIRS); do $(MAKE) -C $$i $@ || exit; done |
| 6 |
|
| 7 |
include ../config.mak |
| 8 |
|
| 9 |
SRCS = vidixlib.c |
| 10 |
OBJS = $(SRCS:.c=.o) |
| 11 |
|
| 12 |
CFLAGS = $(OPTFLAGS) -W -Wall |
| 13 |
|
| 14 |
.SUFFIXES: .c .o |
| 15 |
|
| 16 |
# .PHONY: all clean |
| 17 |
|
| 18 |
.c.o: |
| 19 |
$(CC) -c $(CFLAGS) -o $@ $< |
| 20 |
|
| 21 |
all: $(SUBDIRS) $(LIBNAME) |
| 22 |
$(DO_MAKE) |
| 23 |
|
| 24 |
$(LIBNAME): $(OBJS) |
| 25 |
$(LD) -shared -soname $(LIBNAME) -o $(LIBNAME) $(OBJS) -lc -ldl |
| 26 |
|
| 27 |
clean: |
| 28 |
rm -f *.o $(LIBNAME) *~ |
| 29 |
$(DO_MAKE) |
| 30 |
|
| 31 |
distclean: |
| 32 |
rm -f test *.o $(LIBNAME) *~ .depend |
| 33 |
$(DO_MAKE) |
| 34 |
|
| 35 |
dep: depend |
| 36 |
$(DO_MAKE) |
| 37 |
|
| 38 |
depend: |
| 39 |
$(CC) -MM $(CFLAGS) $(SRCS) 1>.depend |
| 40 |
|
| 41 |
install: |
| 42 |
$(DO_MAKE) |
| 43 |
mkdir -p $(BINDIR) |
| 44 |
install -m 755 -s -p $(LIBNAME) $(BINDIR) |
| 45 |
ifeq ($(TARGET_OS),OpenBSD) |
| 46 |
$(LDCONFIG) -R |
| 47 |
else |
| 48 |
$(LDCONFIG) |
| 49 |
endif |
| 50 |
mkdir -p $(INCDIR) |
| 51 |
install -m 644 fourcc.h $(INCDIR)/fourcc.h |
| 52 |
install -m 644 vidix.h $(INCDIR)/vidix.h |
| 53 |
install -m 644 vidixlib.h $(INCDIR)/vidixlib.h |
| 54 |
|
| 55 |
uninstall: |
| 56 |
$(DO_MAKE) |
| 57 |
rm -f $(BINDIR)/$(LIBNAME) |
| 58 |
rmdir -p --ignore-fail-on-non-empty $(BINDIR) |
| 59 |
rm -f $(INCDIR)/* |
| 60 |
rmdir -p --ignore-fail-on-non-empty $(INCDIR) |
| 61 |
|
| 62 |
# |
| 63 |
# include dependency files if they exist |
| 64 |
# |
| 65 |
ifneq ($(wildcard .depend),) |
| 66 |
include .depend |
| 67 |
endif |