Skip to content

Instantly share code, notes, and snippets.

@seife
Created February 22, 2017 10:16
Show Gist options
  • Save seife/8a5fbc9ab8fb5af96485d2e378ef909b to your computer and use it in GitHub Desktop.
Save seife/8a5fbc9ab8fb5af96485d2e378ef909b to your computer and use it in GitHub Desktop.
neutrino-native Makefile
####################################################
# Makefile for building native neutrino / libstb-hal
# (C) 2012,2013 Stefan Seyfried
#
# prerequisite packages need to be installed,
# no checking is done for that
####################################################
SOURCE = $(PWD)/source
OBJ = $(PWD)/obj
DEST = $(PWD)/root
LIBDEST = $(PWD)/libs
LH_SRC = $(SOURCE)/libstb-hal
LH_OBJ = $(OBJ)/libstb-hal
N_SRC = $(SOURCE)/neutrino-mp
N_SRC2 = $(SOURCE)/neutrino-mp2
N_OBJ = $(OBJ)/neutrino-mp
CFLAGS = -funsigned-char -g -W -Wall -Wshadow -O2
#CFLAGS += -Wnarrowing -Wconversion
CFLAGS += -Wno-deprecated-declarations
CFLAGS += -rdynamic
CFLAGS += -DPEDANTIC_VALGRIND_SETUP
CFLAGS += -DDYNAMIC_LUAPOSIX
CFLAGS += -DTEST_MENU
CFLAGS += -D_FORTIFY_SOURCE=2
CFLAGS += -Wno-unused-result
CFLAGS += $(EXTRA_CFLAGS)
#CFLAGS += -fvisibility=hidden
### enable --as-needed for catching more build problems...
CFLAGS += -Wl,--as-needed
CFLAGS += -I$(LIBDEST)/include
CFLAGS += -L$(LIBDEST)/lib
PKG_CONFIG_PATH = $(LIBDEST)/lib/pkgconfig
#CC = gcc-5
#CXX = g++-5
#CPP = cpp-5
EXTRA_CFLAGS := $(shell $(CC) -Werror=date-time -c -x c /dev/null&&echo "-Werror=date-time")
export CC CXX CPP
export PKG_CONFIG_PATH
CXXFLAGS = $(CFLAGS)
export CFLAGS CXXFLAGS
# first target is default...
default: neutrino
make run
run:
gdb -ex run $(DEST)/bin/neutrino
neutrino: $(N_OBJ)/config.status
-rm $(N_OBJ)/src/neutrino # force relinking on changed libstb-hal
$(MAKE) -C $(N_OBJ) install
neutrino2: $(N_SRC2)/config.status
-rm $(N_SRC2)/src/neutrino # force relinking on changed libstb-hal
cd $(N_SRC2) && $(MAKE)
$(LH_OBJ)/libstb-hal.a: libstb-hal
libstb-hal: $(LH_OBJ)/config.status
$(MAKE) -C $(LH_OBJ) install
$(LH_OBJ)/config.status: | $(LH_OBJ) $(LH_SRC)
$(LH_SRC)/autogen.sh
set -e; cd $(LH_OBJ); \
$(LH_SRC)/configure --enable-maintainer-mode \
--prefix=$(DEST) \
--enable-shared=no \
--enable-gstreamer \
--enable-clutter \
INSTALL="`which install` -p"
$(N_SRC2)/config.status: | $(LH_OBJ)/libstb-hal.a
$(N_SRC2)/autogen.sh
set -e; cd $(N_SRC2); \
./configure --enable-maintainer-mode \
--prefix=$(DEST) \
--enable-silent-rules --enable-mdev \
--enable-giflib \
--enable-cleanup \
--with-target=native --with-boxtype=generic \
--with-stb-hal-includes=$(DEST)/include/libstb-hal \
--with-stb-hal-build=$(LH_OBJ) \
; \
test -e svn_version.h || echo '#define BUILT_DATE "error - not set"' > svn_version.h; \
test -e git_version.h || echo '#define BUILT_DATE "error - not set"' > git_version.h; \
test -e version.h || touch version.h
$(N_OBJ)/config.status: | $(N_OBJ) $(N_SRC) $(LH_OBJ)/libstb-hal.a
$(N_SRC)/autogen.sh
set -e; cd $(N_OBJ); \
$(N_SRC)/configure --enable-maintainer-mode \
--prefix=$(DEST) \
--enable-silent-rules --enable-mdev \
--enable-pugixml \
--enable-giflib \
--enable-cleanup \
--with-tremor \
--enable-ffmpegdec \
--enable-mdev \
--with-target=native --with-boxtype=generic \
--with-stb-hal-includes=$(DEST)/include/libstb-hal \
--with-stb-hal-build=$(LH_OBJ) \
; \
test -e svn_version.h || echo '#define BUILT_DATE "error - not set"' > svn_version.h; \
test -e git_version.h || echo '#define BUILT_DATE "error - not set"' > git_version.h; \
test -e version.h || touch version.h
$(OBJ):
mkdir $(OBJ)
$(OBJ)/neutrino-mp \
$(OBJ)/libstb-hal: | $(OBJ)
mkdir $@
$(SOURCE):
mkdir $@
$(LH_SRC): | $(SOURCE)
cd $(SOURCE) && git clone git://gitorious.org/neutrino-hd/libstb-hal.git
$(N_SRC): | $(SOURCE)
cd $(SOURCE) && git clone git://gitorious.org/neutrino-mp/neutrino-mp.git
checkout: $(SOURCE)/libstb-hal $(SOURCE)/neutrino-mp
clean:
-$(MAKE) -C $(N_OBJ) clean
-$(MAKE) -C $(LH_OBJ) clean
rm -rf $(N_OBJ) $(LH_OBJ)
# for those poor ubuntu users, who cannot get recent enough ffmpeg & friends...
$(SOURCE)/ffmpeg-1.2.1.tar.bz2: | $(SOURCE)
cd $(SOURCE) && wget http://www.ffmpeg.org/releases/ffmpeg-1.2.1.tar.bz2
ffmpeg: $(SOURCE)/ffmpeg-1.2.1.tar.bz2
tar -C $(SOURCE) -xf $(SOURCE)/ffmpeg-1.2.1.tar.bz2
set -e; cd $(SOURCE)/ffmpeg-1.2.1; \
./configure --prefix=$(LIBDEST) --disable-doc --disable-stripping ; \
$(MAKE); \
make install
# libdvbsi is not commonly packaged for linux distributions...
$(SOURCE)/libdvbsi++-0.3.6.tar.bz2: | $(SOURCE)
cd $(SOURCE) && wget http://www.saftware.de/libdvbsi++/libdvbsi++-0.3.6.tar.bz2
libdvbsi: $(SOURCE)/libdvbsi++-0.3.6.tar.bz2
tar -C $(SOURCE) -xf $(SOURCE)/libdvbsi++-0.3.6.tar.bz2
set -e; cd $(SOURCE)/libdvbsi++-0.3.6; \
./configure --prefix=$(LIBDEST); \
$(MAKE); \
make install
printenv:
echo $(CFLAGS)
PHONY = checkout
.PHONY: $(PHONY)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment