Browse Source

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.
master
Hans-Joerg Schurr 1 year ago
parent
commit
56f7176c91
  1. 4
      README.md
  2. 19
      configure.ac
  3. 2
      shell.nix
  4. 27
      src/Makefile.am

4
README.md

@ -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.

19
configure.ac

@ -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])

2
shell.nix

@ -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 ];
}

27
src/Makefile.am

@ -1,6 +1,7 @@
NULL =
bin_PROGRAMS = hvif
lib_LIBRARIES = libhviflight.a
# hvif configuration
hvif_CFLAGS = \
@ -13,19 +14,39 @@ hvif_CPPFLAGS = \
$(NULL)
hvif_LDADD = \
$(AM_LDADD) \
-lm \
$(CAIRO_LIBS) \
-lm \
libhviflight.a \
$(NULL)
hvif_SOURCES = \
# 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/main.c \
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.h \
src/hvif-cairo.h \
$(NULL)
cquery:
echo '%clang' > .cquery
echo '%c -std=gnu11' >> .cquery

Loading…
Cancel
Save