diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6a0dcdc --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +# +# kare / spoon - CX23416/FX2 USB MPEG capture +# +# FreeBSD / Linux : gmake (GNU make; plain make on Linux) +# + +CC ?= cc +PKG_CONFIG ?= pkg-config + +CFLAGS ?= -O2 -Wall -Wextra -std=c99 +CFLAGS += -Iinclude + +SRCS = src/cx2584x_ser_test.c src/cx2584x_pll_test.c src/device.c src/firmware.c src/encoder.c src/capture.c src/hm12.c src/cx2584x_audio.c src/cx2584x_tables.c src/cx2584x_ser_init.c src/driver_seq.c src/kare.c +OBJS = $(SRCS:.c=.o) +BIN = kare + +# --- libusb-1.0 detection ------------------------------------------- +# Prefer pkg-config; if it is unavailable, fall back to platform defaults. +HAVE_PC := $(shell $(PKG_CONFIG) --exists libusb-1.0 2>/dev/null && echo yes) + +ifeq ($(HAVE_PC),yes) +LDLIBS += $(shell $(PKG_CONFIG) --libs libusb-1.0) +else +LDLIBS += -lusb-1.0 +endif + +# pthread for the -t timeout worker thread +CFLAGS += -pthread +LDLIBS += -pthread +LDLIBS += -lm + +# gmake used to build ONLY mpegcap (all: $(BIN)), so mpegview stayed at +# whatever binary was last built by hand and a fix in mpegview.c looked like +# "no effect" while the viewer was the previous build. Build both. +all: $(BIN) spoon + +$(BIN): $(OBJS) + $(CC) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS) + +%.o: %.c include/pvrusb2.h + $(CC) $(CFLAGS) -c -o $@ $< + +src/capture.o: src/capture.c include/pvrusb2.h include/capture.h + $(CC) $(CFLAGS) -c -o $@ $< + +clean: + rm -f $(OBJS) $(BIN) spoon + +.PHONY: all clean + +# --- spoon: single-binary live viewer (SDL2 + libav, OSS audio) --- +spoon: src/spoon.c + $(CC) $(CFLAGS) -o $@ $< \ + $(shell $(PKG_CONFIG) --cflags --libs libavformat libavcodec \ + libswresample libavutil sdl2) -lm |
