Enable/disable features

This commit is contained in:
Alex Kotov 2020-12-06 05:23:07 +05:00
parent 95716cf4dc
commit a3ddcd8ce9
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 46 additions and 19 deletions

View File

@ -5,32 +5,47 @@ AM_CFLAGS = -std=c99 -Wall -Wextra -I$(top_srcdir)/include
lib_LIBRARIES = libkernaux.a
TESTS = \
examples/cmdline \
tests/test_cmdline \
tests/test_multiboot2_helpers \
tests/test_multiboot2_print \
tests/test_multiboot2_validation \
tests/test_pfa \
tests/test_stdlib
noinst_PROGRAMS = \
$(TESTS) \
tests/multiboot2_print1 \
tests/multiboot2_print2
noinst_PROGRAMS = $(TESTS)
libkernaux_a_SOURCES = \
src/cmdline.c \
src/console.c \
src/multiboot2/helpers.c \
src/multiboot2/is_valid.c \
src/multiboot2/print.c \
src/pfa.c \
src/stdlib.c
if ARCH_X86
libkernaux_a_SOURCES += src/arch/x86.S
endif
if ENABLE_CMDLINE
libkernaux_a_SOURCES += src/cmdline.c
TESTS += \
examples/cmdline \
tests/test_cmdline
endif
if ENABLE_CONSOLE
libkernaux_a_SOURCES += src/console.c
endif
if ENABLE_MULTIBOOT2
libkernaux_a_SOURCES += \
src/multiboot2/helpers.c \
src/multiboot2/is_valid.c \
src/multiboot2/print.c
TESTS += \
tests/test_multiboot2_helpers \
tests/test_multiboot2_print \
tests/test_multiboot2_validation
noinst_PROGRAMS += \
tests/multiboot2_print1 \
tests/multiboot2_print2
endif
if ENABLE_PFA
libkernaux_a_SOURCES += src/pfa.c
TESTS += tests/test_pfa
endif
examples_cmdline_SOURCES = \
$(libkernaux_a_SOURCES) \
examples/cmdline.c

View File

@ -10,10 +10,22 @@ AC_CONFIG_HEADERS([src/config.h])
AC_CANONICAL_HOST
AS_IF([test x"${host_cpu}" = x"x86"],
[AC_DEFINE([ARCH_X86],[1],[architecture is x86])])
AC_ARG_ENABLE([cmdline], AS_HELP_STRING([--disable-cmdline], [disable command line parser]))
AC_ARG_ENABLE([console], AS_HELP_STRING([--disable-console], [disable serial console]))
AC_ARG_ENABLE([multiboot2], AS_HELP_STRING([--disable-multiboot2], [disable Multiboot 2 information parser]))
AC_ARG_ENABLE([pfa], AS_HELP_STRING([--disable-pfa], [disable Page Frame Allocator]))
AM_CONDITIONAL(ARCH_X86, test x"${host_cpu}" = x"x86")
AM_CONDITIONAL([ARCH_X86], [test x"$host_cpu" = x"x86"])
AM_CONDITIONAL([ENABLE_CMDLINE], [test x"$enable_cmdline" != x"no"])
AM_CONDITIONAL([ENABLE_CONSOLE], [test x"$enable_console" != x"no"])
AM_CONDITIONAL([ENABLE_MULTIBOOT2], [test x"$enable_multiboot2" != x"no"])
AM_CONDITIONAL([ENABLE_PFA], [test x"$enable_pfa" != x"no"])
AS_IF([test x"$host_cpu" = x"x86"], [AC_DEFINE([ARCH_X86], [1], [architecture is x86])])
AS_IF([test x"$enable_cmdline" != x"no"], [AC_DEFINE([ENABLE_CMDLINE], [1], [enabled command line parser])])
AS_IF([test x"$enable_console" != x"no"], [AC_DEFINE([ENABLE_CONSOLE], [1], [enabled serial console])])
AS_IF([test x"$enable_multiboot2" != x"no"], [AC_DEFINE([ENABLE_MULTIBOOT2], [1], [enabled Multiboot 2 information parser])])
AS_IF([test x"$enable_pfa" != x"no"], [AC_DEFINE([ENABLE_PFA], [1], [enabled Page Frame Allocator])])
AM_INIT_AUTOMAKE([1.9 subdir-objects -Wall -Werror])