Commit 590dba6f authored by Sebastian Ramacher's avatar Sebastian Ramacher

Move to same directory layout as zathura

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 2da44b97
This diff is collapsed.
......@@ -27,6 +27,14 @@ INCLUDEDIR ?= ${PREFIX}/include
# locale directory
LOCALEDIR ?= ${PREFIX}/share/locale
# build directories
DEPENDDIR ?= .depend
BUILDDIR ?= build
BUILDDIR_RELEASE ?= ${BUILDDIR}/release
BUILDDIR_DEBUG ?= ${BUILDDIR}/debug
BUILDDIR_GCOV ?= ${BUILDDIR}/gcov
BINDIR ?= bin
# version checks
# If you want to disable any of the checks, set *_VERSION_CHECK to 0.
......@@ -79,6 +87,16 @@ GETTEXT_PACKAGE ?= lib${PROJECT}-${SOMAJOR}
# msgfmt
MSGFMT ?= msgfmt
# gcov & lcov
GCOV_CFLAGS=-fprofile-arcs -ftest-coverage
GCOV_LDFLAGS=-fprofile-arcs
LCOV_OUTPUT=gcov
LCOV_EXEC=lcov
LCOV_FLAGS=--base-directory . --directory ${BUILDDIR_GCOV} --capture --rc \
lcov_branch_coverage=1 --output-file ${BUILDDIR_GCOV}/$(PROJECT).info
GENHTML_EXEC=genhtml
GENHTML_FLAGS=--rc lcov_branch_coverage=1 --output-directory ${LCOV_OUTPUT} ${BUILDDIR_GCOV}/$(PROJECT).info
# colors
COLOR ?= 1
......
......@@ -2,7 +2,7 @@
# General information
PROJECT_NAME = girara
OUTPUT_DIRECTORY = ./doc/
OUTPUT_DIRECTORY = build
OUTPUT_LANGUAGE = English
TAB_SIZE = 2
EXTRACT_ALL = YES
......@@ -16,9 +16,9 @@ WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
# Input files
INPUT =
EXCLUDE = ./tests
FILE_PATTERNS = *.h *.c
INPUT = ../
EXCLUDE = ../tests
FILE_PATTERNS = *.h
RECURSIVE = YES
# Output files
......
......@@ -23,7 +23,7 @@ clean:
POTFILES.in: $(wildcard ../*.c)
$(QUIET) set -e && rm -f $@.tmp && touch $@.tmp && \
for f in $(^F) ; do \
echo $$f >> $@.tmp ; \
echo ../$$f >> $@.tmp ; \
done && \
mv $@.tmp $@
......
......@@ -6,60 +6,116 @@ include ../colors.mk
include config.mk
PROJECT = test
SOURCE = tests.c $(wildcard test_*.c)
OBJECTS = ${SOURCE:.c=.o}
DOBJECTS = ${SOURCE:.c=.do}
OBJECTS = $(addprefix ${BUILDDIR_RELEASE}/,${SOURCE:.c=.o})
OBJECTS_DEBUG = $(addprefix ${BUILDDIR_DEBUG}/,${SOURCE:.c=.o})
OBJECTS_GCOV = $(addprefix ${BUILDDIR_GCOV}/,${SOURCE:.c=.o})
GIRARA_OBJECTS = $(wildcard ${GIRARA_RELEASE}/*.o)
GIRARA_OBJECTS_DEBUG = $(wildcard ${GIRARA_DEBUG}/*.o)
GIRARA_OBJECTS_GCOV = $(wildcard ${GIRARA_GCOV}/*.o)
XDG_HELPER_SOURCE = xdg_test_helper.c
XDG_HELPER = ${XDG_HELPER_SOURCE:.c=}
XDG_HELPER = $(addprefix ${BUILDDIR_RELEASE}/,${XDG_HELPER_SOURCE:.c=})
all: options girara_test ${XDG_HELPER}
CPPFLAGS += -I../girara -DXDG_TEST_HELPER=\"${XDG_HELPER}\"
run: girara_test ${XDG_HELPER}
$(ECHO) "running tests ..."
$(QUIET)G_SLICE=debug-blocks ./girara_test
all: release ${XDG_HELPER}
debug: options girara_test-debug ${XDG_HELPER}
../girara/version.h:
$(MAKE) -C .. girara/version.h
run-debug: debug
$(ECHO) "running tests ..."
$(QUIET)G_SLICE=debug-blocks ./girara_test-debug
# release
options:
@echo ${PROJECT} build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "DFLAGS = ${DFLAGS}"
@echo "CC = ${CC}"
${OBJECTS}: config.mk ../config.mk ../girara/version.h
%.o: %.c
@mkdir -p .depend
${BUILDDIR_RELEASE}/%.o: %.c
$(call colorecho,CC,$<)
$(QUIET)${CC} -c -I.. ${CPPFLAGS} ${CFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p $(dir $(abspath $@))
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} \
-o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep
${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}: ${OBJECTS}
$(QUIET)$(MAKE) -C .. release
$(call colorecho,CC,$@)
@mkdir -p ${BUILDDIR_RELEASE}/${BINDIR}
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} \
-o ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT} \
${OBJECTS} ${GIRARA_OBJECTS} ${LIBS}
release: ${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
run: release ${XDG_HELPER}
$(QUIET)./${BUILDDIR_RELEASE}/${BINDIR}/${PROJECT}
# debug
${OBJECTS_DEBUG}: config.mk ../config.mk ../girara/version.h
${XDG_HELPER}: ${XDG_HELPER_SOURCE} ../libgirara-gtk3.a
@mkdir -p .depend
${BUILDDIR_DEBUG}/%.o: %.c
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p $(dir $(abspath $@))
$(call colorecho,CC,$<)
$(QUIET)${CC} -I.. ${CPPFLAGS} ${CFLAGS} -o $@ $< ../libgirara-gtk3.a ${LDFLAGS} ${LIBS} -MMD -MF .depend/$@.dep
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${DFLAGS} \
-o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep
%.do: %.c
@mkdir -p .depend
${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}: ${OBJECTS_DEBUG}
$(QUIET)$(MAKE) -C .. debug
$(call colorecho,CC,$@)
@mkdir -p ${BUILDDIR_DEBUG}/${BINDIR}
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} \
-o ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT} \
${OBJECTS} ${GIRARA_OBJECTS_DEBUG} ${LIBS}
debug: ${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
run-debug: debug ${XDG_HELPER}
$(QUIET)./${BUILDDIR_DEBUG}/${BINDIR}/${PROJECT}
# gcov
${OBJECTS_GCOV}: config.mk ../config.mk ../girara/version.h
${BUILDDIR_GCOV}/%.o: %.c
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p $(dir $(abspath $@))
$(call colorecho,CC,$<)
$(QUIET)${CC} -c -I.. ${CPPFLAGS} ${CFLAGS} ${DFLAGS} -o $@ $< -MMD -MF .depend/$@.dep
$(QUIET)${CC} -c ${CPPFLAGS} ${CFLAGS} ${GCOV_CFLAGS} ${DFLAGS} ${GCOV_DFLAGS} \
-o $@ $< -MMD -MF ${DEPENDDIR}/$(abspath $@).dep
${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}: ${OBJECTS_GCOV}
$(QUIET)$(MAKE) -C .. gcov
$(call colorecho,CC,$@)
@mkdir -p ${BUILDDIR_GCOV}/${BINDIR}
$(QUIET)${CC} ${SFLAGS} ${LDFLAGS} ${GCOV_CFLAGS} ${GCOV_LDFLAGS} \
-o ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT} \
${OBJECTS} ${GIRARA_OBJECTS_GCOV} ${LIBS}
gcov: ${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}
girara_test: ${OBJECTS} ../libgirara-gtk3.a
$(call colorecho,LD,$@)
$(QUIET)${CC} ${LDFLAGS} -o $@ ${OBJECTS} ../libgirara-gtk3.a ${LIBS}
run-gcov: gcov
$(QUIET)./${BUILDDIR_GCOV}/${BINDIR}/${PROJECT}
girara_test-debug: ${DOBJECTS} ../libgirara-gtk3-debug.a
$(call colorecho,LD,$@)
$(QUIET)${CC} ${LDFLAGS} -o $@ ${DOBJECTS} ../libgirara-gtk3-debug.a ${LIBS}
# XDG test helper
${DOBJECTS} ${OBJECTS}: ../config.mk
${XDG_HELPER}: ${XDG_HELPER_SOURCE}
$(MAKE) -C .. release
@mkdir -p ${DEPENDDIR}/$(dir $(abspath $@))
@mkdir -p $(dir $(abspath $@))
$(call colorecho,CC,$@)
$(QUIET)${CC} ${CPPFLAGS} ${CFLAGS} -o $@ $< ${GIRARA_OBJECTS} \
${LDFLAGS} ${LIBS} -MMD -MF ${DEPENDDIR}/$(abspath $@).dep
clean:
$(QUIET)rm -rf ${OBJECTS} ${DOBJECTS} girara_test \
girara_test-debug .depend ${XDG_HELPER} *gcda *gcno
$(call colorecho,RM, "Clean test files")
$(QUIET)rm -rf ${PROJECT}
$(QUIET)rm -rf ${PROJECT}-debug
$(QUIET)rm -rf ${PROJECT}-gcov
$(QUIET)rm -rf ${BUILDDIR}
$(QUIET)rm -rf ${DEPENDDIR}
.PHONY: all options clean debug run run-debug
.PHONY: all clean debug gciv run run-debug run-gcov
-include $(wildcard .depend/*.dep)
-include $(wildcard ${DEPENDDIR}/*.dep)
......@@ -4,3 +4,7 @@ CHECK_INC ?= $(shell pkg-config --cflags check)
CHECK_LIB ?= $(shell pkg-config --libs check)
LIBS += ${CHECK_LIB}
GIRARA_RELEASE=../${BUILDDIR_RELEASE}/girara
GIRARA_DEBUG=../${BUILDDIR_DEBUG}/girara
GIRARA_GCOV=../${BUILDDIR_GCOV}/girara
......@@ -5,9 +5,9 @@
#include <glib/gstdio.h>
#include <unistd.h>
#include "../session.h"
#include "../settings.h"
#include "../config.h"
#include "session.h"
#include "settings.h"
#include "config.h"
START_TEST(test_config_parse) {
girara_session_t* session = girara_session_create();
......
......@@ -2,7 +2,7 @@
#include <check.h>
#include "../session.h"
#include "session.h"
START_TEST(test_create) {
girara_session_t* session = girara_session_create();
......
......@@ -2,8 +2,8 @@
#include <check.h>
#include "../session.h"
#include "../settings.h"
#include "session.h"
#include "settings.h"
START_TEST(test_settings_basic) {
girara_session_t* session = girara_session_create();
......
......@@ -2,8 +2,8 @@
#include <check.h>
#include "../template.h"
#include "../datastructures.h"
#include "template.h"
#include "datastructures.h"
START_TEST(test_new) {
GiraraTemplate* obj = girara_template_new(NULL);
......
......@@ -16,8 +16,8 @@
#include <stdlib.h>
#include <stdio.h>
#include "../utils.h"
#include "../datastructures.h"
#include "utils.h"
#include "datastructures.h"
static girara_list_t*
read_pwd_info(void)
......@@ -135,7 +135,7 @@ xdg_path_impl(girara_xdg_path_t path, const gchar* envvar,
#else
gchar* envp[] = { g_strdup_printf("%s=", envvar), NULL };
#endif
gchar* argv[] = { "./xdg_test_helper", g_strdup_printf("%d", path), NULL };
gchar* argv[] = { XDG_TEST_HELPER, g_strdup_printf("%d", path), NULL };
gchar* output = NULL;
bool result = g_spawn_sync(NULL, argv, envp, G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, &output, NULL, NULL, NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment