1
0
Fork 0

Change buildsystem to build a library

- Build a library and a binary.
- Remove lto for now.
- Remove some other compiler arguments.
- Mention that cairo is a dependency for now in README.
This commit is contained in:
Hans-Joerg Schurr 2020-05-29 23:27:03 +02:00
parent 1a5245e4db
commit 56f7176c91
4 changed files with 34 additions and 18 deletions

View File

@ -39,6 +39,10 @@ $ ./configure
$ make -j
```
Since no sensible functionality independent of cairo is implemented as of now,
cairo is a hard dependency. On NixOS the included `shell.nix` script can be
used to bring the dependencies and a couple of development tools intos cope.
HTML documentation can be generated with `make html` if Doxygen is
installed.

View File

@ -17,6 +17,10 @@ AX_CHECK_COMPILE_FLAG([-std=c11],
[ CFLAGS+=" -std=c11" ],
[ AC_MSG_ERROR([C compiler doesn't support C11 mode])] )
# Other tools
AC_PROG_RANLIB
AM_PROG_AR
# Checks for header files.
AC_CHECK_HEADERS([assert.h math.h stdint.h stdlib.h stdbool.h stdio.h])
@ -32,13 +36,10 @@ AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_CHECK_FUNCS([memmove memset mkdir pow strchr strdup strstr strtol])
# User defined options: debug, lto
# User defined options: debug
AC_ARG_ENABLE([debug],
[AS_HELP_STRING([--enable-debug],[compile with debug options])],
[debug=${enableval}], [debug=no])
AC_ARG_ENABLE([lto],
[AS_HELP_STRING([--disable-lto], [disable link time optimization])],
[lto=${enableval}], [lto=yes])
# Libraries
PKG_CHECK_MODULES([CAIRO], [cairo])
@ -52,19 +53,9 @@ if test x$debug = xyes; then
CFLAGS+=" -ftrapv"
CPPFLAGS+="-DDEBUG"
YFLAGS+=" --debug -v"
lto=no
else
CFLAGS+=" -O3"
CPPFLAGS+=" -DNDEBUG"
CFLAGS+=" -fomit-frame-pointer"
AX_CHECK_COMPILE_FLAG([-finline-limit=1000000 ],
[ CFLAGS+=" -finline-limit=1000000" ])
fi
if test x$lto = xyes; then
AX_CHECK_COMPILE_FLAG([-flto],
[ CFLAGS+=" -flto" ],
[ AC_MSG_WARN([C compiler doesn't support link time optimization])] )
fi
AC_CONFIG_FILES([Makefile src/Makefile])

View File

@ -15,6 +15,6 @@ pkgs.stdenv.mkDerivation {
name = "hvif-light";
hardeningDisable = [ "all" ];
buildInputs = with pkgs; [ autoconf automake gcc clang-tools gdb valgrind-light pkg-config cairo doxygen ];
buildInputs = with pkgs; [ autoconf automake gcc clang-tools gdb valgrind-light pkg-config cairo doxygen libtool ];
}

View File

@ -1,6 +1,7 @@
NULL =
bin_PROGRAMS = hvif
lib_LIBRARIES = libhviflight.a
# hvif configuration
hvif_CFLAGS = \
@ -13,16 +14,36 @@ hvif_CPPFLAGS = \
$(NULL)
hvif_LDADD = \
$(AM_LDADD) \
-lm \
$(CAIRO_LIBS) \
-lm \
libhviflight.a \
$(NULL)
# libhviflight.a configuration
libhviflight_a_CFLAGS = \
$(AM_CFLAGS) \
$(CAIRO_CFLAGS) \
$(NULL)
libhviflight_a_CPPFLAGS = \
$(AM_CPPFLAGS) \
-I$(top_builddir)/src \
$(NULL)
libhviflight_a_LIBADD = \
$(AM_LIBAD) \
$(NULL)
libhviflight_a_SOURCES = \
$(BUILT_SOURCES) \
src/hvif-light.c \
src/hvif-light.h \
src/hvif-cairo.c \
src/hvif-cairo.h \
$(NULL)
hvif_SOURCES = \
$(BUILT_SOURCES) \
src/main.c \
src/hvif-light.c \
src/hvif-light.h \
src/hvif-cairo.c \
src/hvif-cairo.h \
$(NULL)