From 161bb0fdde925cd26c347c352d2d2af08064a2fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vasseur?= Date: Wed, 6 Dec 2017 19:18:41 +0000 Subject: [PATCH] examples: cleanup Makefile --- Makefile | 11 ++++++++--- examples/.gitignore | 1 + examples/Makefile | 20 +++++++++++--------- 3 files changed, 20 insertions(+), 12 deletions(-) create mode 100644 examples/.gitignore diff --git a/Makefile b/Makefile index e1b1a41..d5c6d21 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,8 @@ INCLUDE = $(subst //,/,$(DESTDIR)/$(PREFIX)/include/bitstream) VERSION = 1.2 all: - @echo "Run \"make install\" to install biTStream into $(INCLUDE)" + ln -nsf .. examples/bitstream + $(MAKE) -C examples install: @echo "INSTALL $(INCLUDE)" @@ -35,6 +36,10 @@ uninstall: @rm -rf $(INCLUDE) dist: - git archive --format=tar --prefix=bitstream-$(VERSION)/ master | bzip2 -9 > bitstream-$(VERSION).tar.bz2 + git archive --format=tar --prefix=bitstream-$(VERSION)/ master | \ + bzip2 -9 > bitstream-$(VERSION).tar.bz2 -.PHONY: install uninstall distcheck +clean: + $(MAKE) -C examples clean + +.PHONY: all install uninstall dist clean diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 0000000..3b2124a --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1 @@ +/bitstream diff --git a/examples/Makefile b/examples/Makefile index 61ac82f..984c8b6 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,22 +1,24 @@ -CFLAGS = -Wall -O2 -g -CFLAGS_LOCAL = -Wall -O2 -g -I. -I../.. -LDFLAGS = -lrt +PREFIX ?= /usr/local +WARN = -Wall -Wextra -Wno-unused-parameter -Wno-sign-compare +CPPFLAGS = -I. +CFLAGS := $(WARN) -O2 -g $(CFLAGS) +LDFLAGS := -lrt $(LDFLAGS) OBJ = dvb_print_si dvb_gen_si dvb_ecmg dvb_ecmg_test mpeg_print_pcr rtp_check_seqnum mpeg_restamp ifeq "$(shell uname -s)" "Darwin" -LDFLAGS += -liconv +LDLIBS += -liconv # Prevent generation of .dSYM debug directories CFLAGS += -gstabs -CFLAGS_LOCAL += -gstabs endif all: $(OBJ) %: %.c - $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) -local: CFLAGS = $(CFLAGS_LOCAL) -local: all +install: $(OBJ) + install -d "$(DESTDIR)$(PREFIX)/bin" + install -m 755 $(OBJ) "$(DESTDIR)$(PREFIX)/bin" clean: - rm -rf $(OBJ) + $(RM) $(OBJ)