1 # These can be overridden if needed
2 # DESTDIR is completely respected
5 CFLAGS := -Wall $(CFLAGS)
7 LDFLAGS := -L. -lossp $(LDFLAGS)
10 UDEVDIR := /etc/udev/rules.d
12 ifeq "$(origin OSSPD_CFLAGS)" "undefined"
13 OSSPD_CFLAGS := $(shell pkg-config --cflags fuse)
16 ifeq "$(origin OSSPD_LDFLAGS)" "undefined"
17 OSSPD_LDFLAGS := $(shell pkg-config --libs fuse)
20 ifeq "$(origin OSSP_PADSP_CFLAGS)" "undefined"
21 OSSP_PADSP_CFLAGS := $(shell pkg-config --cflags libpulse)
24 ifeq "$(origin OSSP_PADSP_LDFLAGS)" "undefined"
25 OSSP_PADSP_LDFLAGS := $(shell pkg-config --libs libpulse)
28 ifeq "$(origin OSSP_ALSAP_CFLAGS)" "undefined"
29 OSSP_ALSAP_CFLAGS := $(shell pkg-config --libs alsa)
32 ifeq "$(origin OSSP_ALSAP_LDFLAGS)" "undefined"
33 OSSP_ALSAP_LDFLAGS := $(shell pkg-config --libs alsa)
36 headers := ossp.h ossp-util.h ossp-slave.h
38 all: osspd ossp-padsp ossp-alsap
41 mkdir -p $(DESTDIR)$(prefix)/sbin
42 install -m755 osspd ossp-padsp ossp-alsap $(DESTDIR)$(prefix)/sbin
43 mkdir -p $(DESTDIR)$(UDEVDIR)
44 install -m644 98-osscuse.rules $(DESTDIR)$(UDEVDIR)
46 libossp.a: ossp.c ossp.h ossp-util.c ossp-util.h ossp-slave.c ossp-slave.h
47 $(CC) $(CFLAGS) -c -o ossp.o ossp.c
48 $(CC) $(CFLAGS) -c -o ossp-util.o ossp-util.c
49 $(CC) $(CFLAGS) -c -o ossp-slave.o ossp-slave.c
50 $(AR) rc $@ ossp.o ossp-util.o ossp-slave.o
52 osspd: osspd.c libossp.a $(headers)
53 $(CC) $(CFLAGS) $(OSSPD_CFLAGS) -o $@ $< $(OSSPD_LDFLAGS) $(LDFLAGS)
55 ossp-padsp: ossp-padsp.c libossp.a $(headers)
56 $(CC) $(CFLAGS) $(OSSP_PADSP_CFLAGS) -o $@ $< $(OSSP_PADSP_LDFLAGS) $(LDFLAGS)
58 ossp-alsap: ossp-alsap.c libossp.a $(headers)
59 $(CC) $(CFLAGS) $(OSSP_ALSAP_CFLAGS) -o $@ $< $(OSSP_ALSAP_LDFLAGS) $(LDFLAGS)
62 $(CC) $(CFLAGS) -o $@ $< $(XLDFLAGS)
68 rm -f *.o *.a osspd ossp-padsp ossp-alsap osstest