mirror of
https://github.com/ultravideo/uvg266.git
synced 2024-11-30 12:44:07 +00:00
Clean Makefile a bit. Add debug build option.
This commit is contained in:
parent
73db9fec83
commit
0081384727
98
src/Makefile
98
src/Makefile
|
@ -66,6 +66,8 @@ WARNINGS = -Wall -Wtype-limits -Wvla
|
||||||
|
|
||||||
INCLUDEDIRS = -I. -I./strategies -I./extras -I..
|
INCLUDEDIRS = -I. -I./strategies -I./extras -I..
|
||||||
|
|
||||||
|
STRATEGIES = generic sse2 sse41 avx2 x86_asm altivec
|
||||||
|
|
||||||
#Detect if cc is gcc for the link time optimization flag
|
#Detect if cc is gcc for the link time optimization flag
|
||||||
GCCVERSION = $(shell $(CC) --version | grep GCC)
|
GCCVERSION = $(shell $(CC) --version | grep GCC)
|
||||||
ifneq (, $(GCCVERSION))
|
ifneq (, $(GCCVERSION))
|
||||||
|
@ -75,8 +77,7 @@ endif
|
||||||
CFLAGS += -std=gnu99 $(INCLUDEDIRS) $(WARNINGS)
|
CFLAGS += -std=gnu99 $(INCLUDEDIRS) $(WARNINGS)
|
||||||
LDFLAGS += -lm -pthread
|
LDFLAGS += -lm -pthread
|
||||||
LD = gcc
|
LD = gcc
|
||||||
OBJS = interface_main.o \
|
OBJS = \
|
||||||
encmain.o \
|
|
||||||
bitstream.o \
|
bitstream.o \
|
||||||
cabac.o \
|
cabac.o \
|
||||||
checkpoint.o \
|
checkpoint.o \
|
||||||
|
@ -117,19 +118,21 @@ OBJS = interface_main.o \
|
||||||
strategies/generic/dct-generic.o \
|
strategies/generic/dct-generic.o \
|
||||||
strategies/avx2/dct-avx2.o \
|
strategies/avx2/dct-avx2.o \
|
||||||
strategies/generic/ipol-generic.o \
|
strategies/generic/ipol-generic.o \
|
||||||
strategies/avx2/ipol-avx2.o \
|
strategies/avx2/ipol-avx2.o
|
||||||
|
|
||||||
TEST_OBJS = $(filter-out encmain.o interface_main.o, $(OBJS)) \
|
|
||||||
../tests/dct_tests.o \
|
|
||||||
../tests/intra_sad_tests.o \
|
|
||||||
../tests/sad_tests.o \
|
|
||||||
../tests/satd_tests.o \
|
|
||||||
../tests/speed_tests.o \
|
|
||||||
../tests/tests_main.o \
|
|
||||||
../tests/test_strategies.o \
|
|
||||||
|
|
||||||
|
MAIN_OBJS := encmain.o interface_main.o
|
||||||
|
|
||||||
|
TESTDIR := ../tests
|
||||||
|
TEST_OBJS := \
|
||||||
|
$(TESTDIR)/dct_tests.o \
|
||||||
|
$(TESTDIR)/intra_sad_tests.o \
|
||||||
|
$(TESTDIR)/sad_tests.o \
|
||||||
|
$(TESTDIR)/satd_tests.o \
|
||||||
|
$(TESTDIR)/speed_tests.o \
|
||||||
|
$(TESTDIR)/tests_main.o \
|
||||||
|
$(TESTDIR)/test_strategies.o
|
||||||
|
|
||||||
|
|
||||||
ASMFLAGS += $(INCLUDEDIRS)
|
ASMFLAGS += $(INCLUDEDIRS)
|
||||||
ASMOBJS =
|
ASMOBJS =
|
||||||
|
|
||||||
|
@ -145,28 +148,25 @@ endif
|
||||||
|
|
||||||
|
|
||||||
PROG = ./kvazaar
|
PROG = ./kvazaar
|
||||||
PROGS = $(PROG)
|
DEBUG = ./kvazaar_debug
|
||||||
|
|
||||||
TESTS = ./kvazaar_tests
|
TESTS = ./kvazaar_tests
|
||||||
|
|
||||||
DEPS = $(OBJS:.o=.d)
|
PROGS = $(PROG) $(DEBUG) $(TESTS)
|
||||||
|
|
||||||
|
RELEASE_OBJS = $(MAIN_OBJS) $(OBJS) $(ASMOBJS)
|
||||||
|
DEBUG_OBJS = $(RELEASE_OBJS:.o=_debug.o)
|
||||||
|
TESTS_OBJS = $(TEST_OBJS) $(OBJS) $(ASMOBJS)
|
||||||
|
|
||||||
|
|
||||||
|
DEPS = $(RELEASE_OBJS:.o=.d) $(DEBUG_OBJS:.o=.d) $(TESTS_OBJS:.o=.d)
|
||||||
|
|
||||||
GREATEST = ../greatest/greatest.h
|
GREATEST = ../greatest/greatest.h
|
||||||
|
|
||||||
all: $(PROGS)
|
all: $(PROG)
|
||||||
.PHONY: all clean build_tests tests
|
.PHONY: all clean build_tests tests debug
|
||||||
|
|
||||||
build_tests: $(GREATEST) $(TESTS)
|
|
||||||
|
|
||||||
tests: build_tests
|
|
||||||
$(TESTS)
|
|
||||||
|
|
||||||
$(GREATEST):
|
|
||||||
git submodule init
|
|
||||||
git submodule update
|
|
||||||
|
|
||||||
# Compile files in strategy directories with appropriate flags.
|
# Compile files in strategy directories with appropriate flags.
|
||||||
EXTRA_FLAGS =
|
|
||||||
ifeq ($(ARCH), ppc64)
|
ifeq ($(ARCH), ppc64)
|
||||||
strategies/altivec/%.o: EXTRA_FLAGS += -maltivec -fno-lto
|
strategies/altivec/%.o: EXTRA_FLAGS += -maltivec -fno-lto
|
||||||
else
|
else
|
||||||
|
@ -184,32 +184,40 @@ ifndef KVZ_DISABLE_ASM
|
||||||
strategies/x86_asm/%.o: EXTRA_FLAGS += -DKVZ_COMPILE_ASM
|
strategies/x86_asm/%.o: EXTRA_FLAGS += -DKVZ_COMPILE_ASM
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
debug: LDFLAGS := $(filter-out -O3 -O2 -flto, $(LDFLAGS))
|
||||||
|
debug: CFLAGS := $(filter-out -O3 -O2 -flto, $(CFLAGS))
|
||||||
|
debug: $(DEBUG)
|
||||||
|
|
||||||
$(PROG): $(OBJS) $(ASMOBJS)
|
tests: build_tests
|
||||||
|
$(TESTS)
|
||||||
|
|
||||||
|
build_tests: CFLAGS := $(filter-out -Werror, $(CFLAGS))
|
||||||
|
build_tests: init_submodules $(TESTS)
|
||||||
|
|
||||||
|
REMOVE_FILES = $(RELEASE_OBJS) $(DEBUG_OBJS) $(TESTS_OBJS) $(DEPS) $(PROGS)
|
||||||
|
|
||||||
|
$(PROG): $(RELEASE_OBJS)
|
||||||
|
$(LD) $^ $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
$(DEBUG): $(DEBUG_OBJS)
|
||||||
|
$(LD) $^ $(LDFLAGS) -o $@
|
||||||
|
|
||||||
|
$(TESTS): $(TESTS_OBJS)
|
||||||
$(LD) $^ $(LDFLAGS) -o $@
|
$(LD) $^ $(LDFLAGS) -o $@
|
||||||
|
|
||||||
$(TESTS): $(TEST_OBJS) $(ASMOBJS)
|
%.o %_debug.o: %.asm Makefile
|
||||||
$(LD) $^ $(LDFLAGS) -o $@
|
|
||||||
|
|
||||||
%.o: %.asm Makefile
|
|
||||||
$(AS) $(ASMFLAGS) -o $@ $<
|
$(AS) $(ASMFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
%.o %_debug.o: %.c Makefile
|
||||||
|
$(CC) $(CFLAGS) $(EXTRA_FLAGS) -MMD -MP -c $< -o $@
|
||||||
|
|
||||||
%.d: %.asm Makefile
|
init_submodules:
|
||||||
$(AS) $(ASMFLAGS) -M -o $@ > $<
|
git submodule init
|
||||||
|
git submodule update
|
||||||
%.o: %.c Makefile
|
|
||||||
$(CC) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@
|
|
||||||
|
|
||||||
%.d: %.c Makefile
|
|
||||||
$(CC) $(CFLAGS) -MF"$@" -MM -MP -MT"$@" -MT"$(<:.c=.o)" "$<"
|
|
||||||
|
|
||||||
../tests/%.c: ../tests/%.h Makefile
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f $(OBJS) $(PROGS) $(TESTS) $(ASMOBJS) $(TEST_OBJS) $(DEPS)
|
rm -f $(REMOVE_FILES)
|
||||||
|
|
||||||
ifneq ($(MAKECMDGOALS),clean)
|
ifneq ($(MAKECMDGOALS),clean)
|
||||||
-include $(DEPS)
|
-include $(DEPS)
|
||||||
endif
|
endif
|
||||||
|
|
Loading…
Reference in a new issue