build: update build system to fix some odd use cases
This commit is contained in:
parent
92d0450cca
commit
0fab063340
3 changed files with 24 additions and 21 deletions
41
Makefile
41
Makefile
|
@ -20,8 +20,8 @@
|
||||||
# Configuration
|
# Configuration
|
||||||
#
|
#
|
||||||
|
|
||||||
include ${CURDIR}/.config.mk
|
include $(dir $(lastword $(MAKEFILE_LIST))).config.mk
|
||||||
PROG = ${BUILDDIR}/tvheadend
|
PROG := $(BUILDDIR)/tvheadend
|
||||||
|
|
||||||
#
|
#
|
||||||
# Common compiler flags
|
# Common compiler flags
|
||||||
|
@ -31,9 +31,12 @@ CFLAGS += -Wall -Werror -Wwrite-strings -Wno-deprecated-declarations
|
||||||
CFLAGS += -Wmissing-prototypes -fms-extensions
|
CFLAGS += -Wmissing-prototypes -fms-extensions
|
||||||
CFLAGS += -g -funsigned-char -O2
|
CFLAGS += -g -funsigned-char -O2
|
||||||
CFLAGS += -D_FILE_OFFSET_BITS=64
|
CFLAGS += -D_FILE_OFFSET_BITS=64
|
||||||
CFLAGS += -I${BUILDDIR} -I${CURDIR}/src -I${CURDIR}
|
CFLAGS += -I${BUILDDIR} -I${ROOTDIR}/src -I${ROOTDIR}
|
||||||
LDFLAGS += -lrt -ldl -lpthread -lm
|
LDFLAGS += -lrt -ldl -lpthread -lm
|
||||||
|
|
||||||
|
vpath %.c $(ROOTDIR)
|
||||||
|
vpath %.h $(ROOTDIR)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Other config
|
# Other config
|
||||||
#
|
#
|
||||||
|
@ -45,7 +48,7 @@ BUNDLE_FLAGS = ${BUNDLE_FLAGS-yes}
|
||||||
# Binaries/Scripts
|
# Binaries/Scripts
|
||||||
#
|
#
|
||||||
|
|
||||||
MKBUNDLE = $(PYTHON) $(CURDIR)/support/mkbundle
|
MKBUNDLE = $(PYTHON) $(ROOTDIR)/support/mkbundle
|
||||||
|
|
||||||
#
|
#
|
||||||
# Debug/Output
|
# Debug/Output
|
||||||
|
@ -54,7 +57,7 @@ MKBUNDLE = $(PYTHON) $(CURDIR)/support/mkbundle
|
||||||
ifndef V
|
ifndef V
|
||||||
ECHO = printf "%-16s%s\n" $(1) $(2)
|
ECHO = printf "%-16s%s\n" $(1) $(2)
|
||||||
BRIEF = CC MKBUNDLE CXX
|
BRIEF = CC MKBUNDLE CXX
|
||||||
MSG = $(subst $(CURDIR)/,,$@)
|
MSG = $(subst $(BUILDDIR)/,,$@)
|
||||||
$(foreach VAR,$(BRIEF), \
|
$(foreach VAR,$(BRIEF), \
|
||||||
$(eval $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
|
$(eval $(VAR) = @$$(call ECHO,$(VAR),$$(MSG)); $($(VAR))))
|
||||||
endif
|
endif
|
||||||
|
@ -62,10 +65,10 @@ endif
|
||||||
#
|
#
|
||||||
# Core
|
# Core
|
||||||
#
|
#
|
||||||
SRCS = src/main.c \
|
SRCS = src/version.c \
|
||||||
|
src/main.c \
|
||||||
src/utils.c \
|
src/utils.c \
|
||||||
src/wrappers.c \
|
src/wrappers.c \
|
||||||
src/version.c \
|
|
||||||
src/access.c \
|
src/access.c \
|
||||||
src/dtable.c \
|
src/dtable.c \
|
||||||
src/tcp.c \
|
src/tcp.c \
|
||||||
|
@ -208,7 +211,7 @@ SRCS-${CONFIG_BUNDLE} += bundle.c
|
||||||
BUNDLES-yes += docs/html docs/docresources src/webui/static
|
BUNDLES-yes += docs/html docs/docresources src/webui/static
|
||||||
BUNDLES-yes += data/conf
|
BUNDLES-yes += data/conf
|
||||||
BUNDLES-${CONFIG_DVBSCAN} += data/dvb-scan
|
BUNDLES-${CONFIG_DVBSCAN} += data/dvb-scan
|
||||||
BUNDLES = $(BUNDLES-yes)
|
BUNDLES = $(BUNDLES-yes:%=$(ROOTDIR)/%)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Add-on modules
|
# Add-on modules
|
||||||
|
@ -237,13 +240,13 @@ all: ${PROG}
|
||||||
|
|
||||||
# Check configure output is valid
|
# Check configure output is valid
|
||||||
check_config:
|
check_config:
|
||||||
@test $(CURDIR)/.config.mk -nt $(CURDIR)/configure\
|
@test $(ROOTDIR)/.config.mk -nt $(ROOTDIR)/configure\
|
||||||
|| echo "./configure output is old, please re-run"
|
|| echo "./configure output is old, please re-run"
|
||||||
@test $(CURDIR)/.config.mk -nt $(CURDIR)/configure
|
@test $(ROOTDIR)/.config.mk -nt $(ROOTDIR)/configure
|
||||||
|
|
||||||
# Recreate configuration
|
# Recreate configuration
|
||||||
reconfigure:
|
reconfigure:
|
||||||
$(CURDIR)/configure $(CONFIGURE_ARGS)
|
$(ROOTDIR)/configure $(CONFIGURE_ARGS)
|
||||||
|
|
||||||
# Binary
|
# Binary
|
||||||
${PROG}: check_config $(OBJS) $(ALLDEPS)
|
${PROG}: check_config $(OBJS) $(ALLDEPS)
|
||||||
|
@ -252,7 +255,7 @@ ${PROG}: check_config $(OBJS) $(ALLDEPS)
|
||||||
# Object
|
# Object
|
||||||
${BUILDDIR}/%.o: %.c
|
${BUILDDIR}/%.o: %.c
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) -MD -MP $(CFLAGS) -c -o $@ $(CURDIR)/$<
|
$(CC) -MD -MP $(CFLAGS) -c -o $@ $<
|
||||||
|
|
||||||
# Add-on
|
# Add-on
|
||||||
${BUILDDIR}/%.so: ${SRCS_EXTRA}
|
${BUILDDIR}/%.so: ${SRCS_EXTRA}
|
||||||
|
@ -265,24 +268,24 @@ clean:
|
||||||
find . -name "*~" | xargs rm -f
|
find . -name "*~" | xargs rm -f
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -rf ${CURDIR}/build.*
|
rm -rf ${ROOTDIR}/build.*
|
||||||
rm -f ${CURDIR}/.config.mk
|
rm -f ${ROOTDIR}/.config.mk
|
||||||
|
|
||||||
# Create buildversion.h
|
# Create version
|
||||||
src/version.c: FORCE
|
$(ROOTDIR)/src/version.c: FORCE
|
||||||
@$(CURDIR)/support/version $@ > /dev/null
|
@$(ROOTDIR)/support/version $@ > /dev/null
|
||||||
FORCE:
|
FORCE:
|
||||||
|
|
||||||
# Include dependency files if they exist.
|
# Include dependency files if they exist.
|
||||||
-include $(DEPS)
|
-include $(DEPS)
|
||||||
|
|
||||||
# Include OS specific targets
|
# Include OS specific targets
|
||||||
include support/${OSENV}.mk
|
include ${ROOTDIR}/support/${OSENV}.mk
|
||||||
|
|
||||||
# Bundle files
|
# Bundle files
|
||||||
$(BUILDDIR)/bundle.o: $(BUILDDIR)/bundle.c
|
$(BUILDDIR)/bundle.o: $(BUILDDIR)/bundle.c
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
$(CC) -I${CURDIR}/src -c -o $@ $<
|
$(CC) -I${ROOTDIR}/src -c -o $@ $<
|
||||||
|
|
||||||
$(BUILDDIR)/bundle.c:
|
$(BUILDDIR)/bundle.c:
|
||||||
@mkdir -p $(dir $@)
|
@mkdir -p $(dir $@)
|
||||||
|
|
2
configure
vendored
2
configure
vendored
|
@ -9,7 +9,7 @@
|
||||||
# Setup
|
# Setup
|
||||||
# ###########################################################################
|
# ###########################################################################
|
||||||
|
|
||||||
ROOTDIR=$(dirname $0)
|
ROOTDIR=$(cd $(dirname $0); pwd)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Options
|
# Options
|
||||||
|
|
|
@ -464,7 +464,7 @@ function write_config
|
||||||
# Automatically generated by configure - DO NOT EDIT!
|
# Automatically generated by configure - DO NOT EDIT!
|
||||||
CONFIGURE_ARGS = ${CONFIGURE_ARGS}
|
CONFIGURE_ARGS = ${CONFIGURE_ARGS}
|
||||||
ROOTDIR ?= ${ROOTDIR}
|
ROOTDIR ?= ${ROOTDIR}
|
||||||
BUILDDIR ?= ${ROOTDIR}/build.${PLATFORM}
|
BUILDDIR ?= ${BUILDDIR}
|
||||||
OSENV ?= ${OSENV}
|
OSENV ?= ${OSENV}
|
||||||
ARCH ?= ${ARCH}
|
ARCH ?= ${ARCH}
|
||||||
CPU ?= ${CPU}
|
CPU ?= ${CPU}
|
||||||
|
|
Loading…
Add table
Reference in a new issue