mirror of
https://github.com/tailix/libkernaux.git
synced 2024-11-20 11:06:41 -05:00
Split Make file into subdirectories (#48)
This commit is contained in:
parent
428e33a358
commit
dc7b1002a4
32 changed files with 636 additions and 548 deletions
|
@ -8,7 +8,7 @@ main_freebsd_task:
|
|||
name: Main (FreeBSD)
|
||||
only_if: $CIRRUS_BRANCH == 'master' || $CIRRUS_BASE_BRANCH == 'master'
|
||||
dependencies_script:
|
||||
- pkg install --yes autoconf automake
|
||||
- pkg install --yes autoconf automake libtool
|
||||
main_build_script:
|
||||
- ./autogen.sh
|
||||
- ./configure --enable-tests CFLAGS='-O3'
|
||||
|
@ -25,7 +25,7 @@ mruby_freebsd_task:
|
|||
LIBRARY_PATH: '/usr/local/lib'
|
||||
MRUBY_YAML_USE_SYSTEM_LIBRARY: x
|
||||
dependencies_script:
|
||||
- pkg install --yes autoconf automake git rubygem-rake wget
|
||||
- pkg install --yes autoconf automake git libtool rubygem-rake wget
|
||||
dependencies_mruby_script:
|
||||
- wget https://github.com/mruby/mruby/archive/3.1.0.zip -O mruby-3.1.0.zip
|
||||
- unzip mruby-3.1.0.zip
|
||||
|
@ -45,7 +45,7 @@ ruby_freebsd_task:
|
|||
CPATH: '/usr/local/include'
|
||||
LIBRARY_PATH: '/usr/local/lib'
|
||||
dependencies_script:
|
||||
- pkg install --yes autoconf automake git wget
|
||||
- pkg install --yes autoconf automake git libtool wget
|
||||
dependencies_ruby_script:
|
||||
- wget https://cache.ruby-lang.org/pub/ruby/3.0/ruby-3.0.3.tar.gz
|
||||
- tar -xzf ruby-3.0.3.tar.gz
|
||||
|
@ -72,7 +72,7 @@ rust_freebsd_task:
|
|||
env:
|
||||
RUSTFLAGS: '-L /usr/local/lib'
|
||||
dependencies_script:
|
||||
- pkg install --yes autoconf automake
|
||||
- pkg install --yes autoconf automake libtool
|
||||
dependencies_rust_script:
|
||||
- curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
|
||||
main_build_script:
|
||||
|
|
10
.gitignore
vendored
10
.gitignore
vendored
|
@ -4,10 +4,13 @@
|
|||
|
||||
*.a
|
||||
*.c.d
|
||||
*.la
|
||||
*.lo
|
||||
*.o
|
||||
|
||||
.deps/
|
||||
.dirstamp
|
||||
.libs/
|
||||
|
||||
############################
|
||||
# Always generated in root #
|
||||
|
@ -28,14 +31,17 @@
|
|||
/configure~
|
||||
/depcomp
|
||||
/install-sh
|
||||
/ltmain.sh
|
||||
/missing
|
||||
/test-driver
|
||||
|
||||
/m4/*
|
||||
!/m4/.keep
|
||||
|
||||
# Custom
|
||||
|
||||
/Makefile.in
|
||||
/include/Makefile.in
|
||||
/libc/include/Makefile.in
|
||||
|
||||
########################
|
||||
# To build out of root #
|
||||
|
@ -79,6 +85,7 @@
|
|||
/config.h
|
||||
/config.log
|
||||
/config.status
|
||||
/libtool
|
||||
/stamp-h1
|
||||
/test-suite.log
|
||||
|
||||
|
@ -91,7 +98,6 @@
|
|||
|
||||
/Makefile
|
||||
/include/Makefile
|
||||
/libc/include/Makefile
|
||||
|
||||
/include/kernaux.h
|
||||
/include/kernaux/console.h
|
||||
|
|
|
@ -2,8 +2,8 @@ Common
|
|||
------
|
||||
|
||||
* Add your name to [COPYING](/COPYING).
|
||||
* If you change the behavior (even just fix a bug) of **core** or of
|
||||
[libc](/libc), add a record to [ChangeLog](/ChangeLog).
|
||||
* If you change the behavior (even just fix a bug) of **libkernaux**,
|
||||
[libc](/libc) or [libm](/libm), add a record to [ChangeLog](/ChangeLog).
|
||||
|
||||
|
||||
|
||||
|
|
538
Makefile.am
538
Makefile.am
|
@ -1,85 +1,65 @@
|
|||
##########
|
||||
# Common #
|
||||
##########
|
||||
# FIXME: dependencies are not built automatically with --enable-split-*
|
||||
|
||||
SUBDIRS = include libc/include
|
||||
include $(top_srcdir)/shared.am
|
||||
|
||||
CLEANFILES =
|
||||
TESTS =
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
EXTRA_DIST = autogen.sh CONTRIBUTING.md sha256sums.txt
|
||||
|
||||
AM_CFLAGS = \
|
||||
-std=c99 \
|
||||
-pedantic \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-I$(top_builddir)/include \
|
||||
-I$(top_srcdir)/include \
|
||||
-D_POSIX_C_SOURCE=200809L
|
||||
SUBDIRS = include
|
||||
|
||||
if WITH_LIBC
|
||||
AM_CFLAGS += \
|
||||
-I$(top_builddir)/libc/include \
|
||||
-I$(top_srcdir)/libc/include
|
||||
SUBDIRS += libc
|
||||
endif
|
||||
if WITH_LIBM
|
||||
SUBDIRS += libm
|
||||
endif
|
||||
|
||||
if ENABLE_WERROR
|
||||
AM_CFLAGS += -Werror
|
||||
SUBDIRS += .
|
||||
|
||||
if ENABLE_TESTS
|
||||
SUBDIRS += examples tests
|
||||
endif
|
||||
|
||||
# TODO: DRY (configure.ac)
|
||||
if ENABLE_FREESTANDING
|
||||
AM_CFLAGS += -nostdlib -ffreestanding -fno-pic -fno-stack-protector
|
||||
else
|
||||
AM_CFLAGS += -fpic
|
||||
endif
|
||||
lib_LTLIBRARIES = libkernaux.la
|
||||
|
||||
#######
|
||||
# all #
|
||||
#######
|
||||
libkernaux_la_SOURCES = src/libc.h src/assert.c
|
||||
libkernaux_la_LIBADD =
|
||||
|
||||
lib_LIBRARIES = libkernaux.a
|
||||
noinst_PROGRAMS = $(TESTS)
|
||||
|
||||
################
|
||||
# libkernaux.a #
|
||||
################
|
||||
|
||||
libkernaux_a_SOURCES = src/libc.h src/assert.c
|
||||
if ASM_I386
|
||||
libkernaux_a_SOURCES += src/asm/i386.S
|
||||
libkernaux_la_SOURCES += src/asm/i386.S
|
||||
endif
|
||||
if ASM_RISCV64
|
||||
libkernaux_a_SOURCES += src/asm/riscv64.S
|
||||
libkernaux_la_SOURCES += src/asm/riscv64.S
|
||||
endif
|
||||
if ASM_X86_64
|
||||
libkernaux_a_SOURCES += src/asm/x86_64.S
|
||||
libkernaux_la_SOURCES += src/asm/x86_64.S
|
||||
endif
|
||||
if WITH_CMDLINE
|
||||
libkernaux_a_SOURCES += src/cmdline.c
|
||||
libkernaux_la_SOURCES += src/cmdline.c
|
||||
endif
|
||||
if WITH_CONSOLE
|
||||
libkernaux_a_SOURCES += src/console.c
|
||||
libkernaux_la_SOURCES += src/console.c
|
||||
endif
|
||||
if WITH_ELF
|
||||
libkernaux_a_SOURCES += src/elf.c
|
||||
libkernaux_la_SOURCES += src/elf.c
|
||||
endif
|
||||
if WITH_FILE
|
||||
libkernaux_a_SOURCES += src/file.c
|
||||
libkernaux_la_SOURCES += src/file.c
|
||||
endif
|
||||
if WITH_FRAMEBUFFER
|
||||
libkernaux_a_SOURCES += src/framebuffer.c
|
||||
libkernaux_la_SOURCES += src/framebuffer.c
|
||||
endif
|
||||
if WITH_LIBC
|
||||
libkernaux_a_SOURCES += \
|
||||
libc/src/ctype.c \
|
||||
libc/src/stdlib.c \
|
||||
libc/src/string.c
|
||||
libkernaux_la_LIBADD += libc/libc.la
|
||||
endif
|
||||
if WITH_LIBM
|
||||
libkernaux_la_LIBADD += libm/libm.la
|
||||
endif
|
||||
if WITH_MBR
|
||||
libkernaux_a_SOURCES += src/mbr.c
|
||||
libkernaux_la_SOURCES += src/mbr.c
|
||||
endif
|
||||
if WITH_MULTIBOOT2
|
||||
libkernaux_a_SOURCES += \
|
||||
libkernaux_la_SOURCES += \
|
||||
src/multiboot2/enums_to_str.c \
|
||||
src/multiboot2/header_helpers.c \
|
||||
src/multiboot2/header_is_valid.c \
|
||||
|
@ -89,465 +69,17 @@ libkernaux_a_SOURCES += \
|
|||
src/multiboot2/info_print.c
|
||||
endif
|
||||
if WITH_NTOA
|
||||
libkernaux_a_SOURCES += src/ntoa.c
|
||||
libkernaux_la_SOURCES += src/ntoa.c
|
||||
endif
|
||||
if WITH_PFA
|
||||
libkernaux_a_SOURCES += src/pfa.c
|
||||
libkernaux_la_SOURCES += src/pfa.c
|
||||
endif
|
||||
if WITH_PRINTF
|
||||
libkernaux_a_SOURCES += src/printf.c
|
||||
libkernaux_la_SOURCES += src/printf.c
|
||||
endif
|
||||
if WITH_PRINTF_FMT
|
||||
libkernaux_a_SOURCES += src/printf_fmt.c
|
||||
libkernaux_la_SOURCES += src/printf_fmt.c
|
||||
endif
|
||||
if WITH_UNITS
|
||||
libkernaux_a_SOURCES += src/units.c
|
||||
endif
|
||||
|
||||
##########################
|
||||
# examples/assert_guards #
|
||||
##########################
|
||||
|
||||
if ENABLE_TESTS
|
||||
TESTS += examples/assert_guards
|
||||
examples_assert_guards_LDADD = libkernaux.a
|
||||
examples_assert_guards_SOURCES = examples/assert_guards.c
|
||||
endif
|
||||
|
||||
##########################
|
||||
# examples/assert_simple #
|
||||
##########################
|
||||
|
||||
if ENABLE_TESTS
|
||||
TESTS += examples/assert_simple
|
||||
examples_assert_simple_LDADD = libkernaux.a
|
||||
examples_assert_simple_SOURCES = examples/assert_simple.c
|
||||
endif
|
||||
|
||||
####################
|
||||
# examples/cmdline #
|
||||
####################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_CMDLINE
|
||||
TESTS += examples/cmdline
|
||||
examples_cmdline_LDADD = libkernaux.a
|
||||
examples_cmdline_SOURCES = examples/cmdline.c
|
||||
endif
|
||||
endif
|
||||
|
||||
####################
|
||||
# examples/fprintf #
|
||||
####################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_PRINTF
|
||||
if WITH_FILE
|
||||
TESTS += examples/fprintf
|
||||
examples_fprintf_LDADD = libkernaux.a
|
||||
examples_fprintf_SOURCES = examples/fprintf.c
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
#######################
|
||||
# examples/fprintf_va #
|
||||
#######################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_PRINTF
|
||||
if WITH_FILE
|
||||
TESTS += examples/fprintf_va
|
||||
examples_fprintf_va_LDADD = libkernaux.a
|
||||
examples_fprintf_va_SOURCES = examples/fprintf_va.c
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
#################
|
||||
# examples/ntoa #
|
||||
#################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_NTOA
|
||||
TESTS += examples/ntoa
|
||||
examples_ntoa_LDADD = libkernaux.a
|
||||
examples_ntoa_SOURCES = examples/ntoa.c
|
||||
endif
|
||||
endif
|
||||
|
||||
#########################
|
||||
# examples/panic_guards #
|
||||
#########################
|
||||
|
||||
if ENABLE_TESTS
|
||||
TESTS += examples/panic_guards
|
||||
examples_panic_guards_LDADD = libkernaux.a
|
||||
examples_panic_guards_SOURCES = examples/panic_guards.c
|
||||
endif
|
||||
|
||||
#########################
|
||||
# examples/panic_simple #
|
||||
#########################
|
||||
|
||||
if ENABLE_TESTS
|
||||
TESTS += examples/panic_simple
|
||||
examples_panic_simple_LDADD = libkernaux.a
|
||||
examples_panic_simple_SOURCES = examples/panic_simple.c
|
||||
endif
|
||||
|
||||
################
|
||||
# examples/pfa #
|
||||
################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_PFA
|
||||
TESTS += examples/pfa
|
||||
examples_pfa_LDADD = libkernaux.a
|
||||
examples_pfa_SOURCES = examples/pfa.c
|
||||
endif
|
||||
endif
|
||||
|
||||
#######################
|
||||
# examples/printf_fmt #
|
||||
#######################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_PRINTF_FMT
|
||||
TESTS += examples/printf_fmt
|
||||
examples_printf_fmt_LDADD = libkernaux.a
|
||||
examples_printf_fmt_SOURCES = examples/printf_fmt.c
|
||||
endif
|
||||
endif
|
||||
|
||||
#####################
|
||||
# examples/snprintf #
|
||||
#####################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_PRINTF
|
||||
TESTS += examples/snprintf
|
||||
examples_snprintf_LDADD = libkernaux.a
|
||||
examples_snprintf_SOURCES = examples/snprintf.c
|
||||
endif
|
||||
endif
|
||||
|
||||
########################
|
||||
# examples/snprintf_va #
|
||||
########################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_PRINTF
|
||||
TESTS += examples/snprintf_va
|
||||
examples_snprintf_va_LDADD = libkernaux.a
|
||||
examples_snprintf_va_SOURCES = examples/snprintf_va.c
|
||||
endif
|
||||
endif
|
||||
|
||||
########################
|
||||
# examples/units_human #
|
||||
########################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_UNITS
|
||||
TESTS += examples/units_human
|
||||
examples_units_human_LDADD = libkernaux.a
|
||||
examples_units_human_SOURCES = examples/units_human.c
|
||||
endif
|
||||
endif
|
||||
|
||||
##################################
|
||||
# tests/multiboot2_header_print1 #
|
||||
##################################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_MULTIBOOT2
|
||||
noinst_PROGRAMS += tests/multiboot2_header_print1
|
||||
tests_multiboot2_header_print1_LDADD = libkernaux.a
|
||||
tests_multiboot2_header_print1_SOURCES = \
|
||||
tests/multiboot2_header_print1.c \
|
||||
tests/multiboot2_header_example1.h
|
||||
endif
|
||||
endif
|
||||
|
||||
##################################
|
||||
# tests/multiboot2_header_print2 #
|
||||
##################################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_MULTIBOOT2
|
||||
noinst_PROGRAMS += tests/multiboot2_header_print2
|
||||
tests_multiboot2_header_print2_LDADD = libkernaux.a
|
||||
tests_multiboot2_header_print2_SOURCES = \
|
||||
tests/multiboot2_header_print2.c \
|
||||
tests/multiboot2_header_example2.h
|
||||
endif
|
||||
endif
|
||||
|
||||
################################
|
||||
# tests/multiboot2_info_print1 #
|
||||
################################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_MULTIBOOT2
|
||||
noinst_PROGRAMS += tests/multiboot2_info_print1
|
||||
tests_multiboot2_info_print1_LDADD = libkernaux.a
|
||||
tests_multiboot2_info_print1_SOURCES = \
|
||||
tests/multiboot2_info_print1.c \
|
||||
tests/multiboot2_info_example1.h
|
||||
endif
|
||||
endif
|
||||
|
||||
################################
|
||||
# tests/multiboot2_info_print2 #
|
||||
################################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_MULTIBOOT2
|
||||
noinst_PROGRAMS += tests/multiboot2_info_print2
|
||||
tests_multiboot2_info_print2_LDADD = libkernaux.a
|
||||
tests_multiboot2_info_print2_SOURCES = \
|
||||
tests/multiboot2_info_print2.c \
|
||||
tests/multiboot2_info_example2.h
|
||||
endif
|
||||
endif
|
||||
|
||||
######################
|
||||
# tests/test_cmdline #
|
||||
######################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_CMDLINE
|
||||
TESTS += tests/test_cmdline
|
||||
tests_test_cmdline_LDADD = libkernaux.a
|
||||
tests_test_cmdline_SOURCES = tests/test_cmdline.c
|
||||
endif
|
||||
endif
|
||||
|
||||
##########################
|
||||
# tests/test_cmdline_gen #
|
||||
##########################
|
||||
|
||||
if ENABLE_TESTS_PYTHON
|
||||
if WITH_CMDLINE
|
||||
TESTS += tests/test_cmdline_gen
|
||||
tests_test_cmdline_gen_LDADD = libkernaux.a
|
||||
tests_test_cmdline_gen_SOURCES = \
|
||||
tests/test_cmdline_gen.c \
|
||||
tests/cmdline_gen.py \
|
||||
tests/cmdline_gen.jinja \
|
||||
common/cmdline.yml
|
||||
endif
|
||||
endif
|
||||
|
||||
CLEANFILES += tests/test_cmdline_gen.c
|
||||
|
||||
tests/test_cmdline_gen.c: tests/cmdline_gen.py tests/cmdline_gen.jinja common/cmdline.yml
|
||||
python3 tests/cmdline_gen.py
|
||||
|
||||
##################
|
||||
# tests/test_elf #
|
||||
##################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_ELF
|
||||
TESTS += tests/test_elf
|
||||
tests_test_elf_LDADD = libkernaux.a
|
||||
tests_test_elf_SOURCES = tests/test_elf.c
|
||||
endif
|
||||
endif
|
||||
|
||||
##################
|
||||
# tests/test_mbr #
|
||||
##################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_MBR
|
||||
TESTS += tests/test_mbr
|
||||
tests_test_mbr_LDADD = libkernaux.a
|
||||
tests_test_mbr_SOURCES = tests/test_mbr.c
|
||||
endif
|
||||
endif
|
||||
|
||||
########################################
|
||||
# tests/test_multiboot2_header_helpers #
|
||||
########################################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_MULTIBOOT2
|
||||
TESTS += tests/test_multiboot2_header_helpers
|
||||
tests_test_multiboot2_header_helpers_LDADD = libkernaux.a
|
||||
tests_test_multiboot2_header_helpers_SOURCES = \
|
||||
tests/test_multiboot2_header_helpers.c \
|
||||
tests/multiboot2_header_example1.h \
|
||||
tests/multiboot2_header_example2.h
|
||||
endif
|
||||
endif
|
||||
|
||||
######################################
|
||||
# tests/test_multiboot2_header_print #
|
||||
######################################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_MULTIBOOT2
|
||||
TESTS += tests/test_multiboot2_header_print
|
||||
tests_test_multiboot2_header_print_DEPENDENCIES = \
|
||||
tests/multiboot2_header_print1 \
|
||||
tests/multiboot2_header_print2
|
||||
tests_test_multiboot2_header_print_LDADD = libkernaux.a
|
||||
tests_test_multiboot2_header_print_SOURCES = \
|
||||
tests/test_multiboot2_header_print.c
|
||||
endif
|
||||
endif
|
||||
|
||||
###########################################
|
||||
# tests/test_multiboot2_header_validation #
|
||||
###########################################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_MULTIBOOT2
|
||||
TESTS += tests/test_multiboot2_header_validation
|
||||
tests_test_multiboot2_header_validation_LDADD = libkernaux.a
|
||||
tests_test_multiboot2_header_validation_SOURCES = \
|
||||
tests/test_multiboot2_header_validation.c \
|
||||
tests/multiboot2_header_example1.h \
|
||||
tests/multiboot2_header_example2.h
|
||||
endif
|
||||
endif
|
||||
|
||||
######################################
|
||||
# tests/test_multiboot2_info_helpers #
|
||||
######################################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_MULTIBOOT2
|
||||
TESTS += tests/test_multiboot2_info_helpers
|
||||
tests_test_multiboot2_info_helpers_LDADD = libkernaux.a
|
||||
tests_test_multiboot2_info_helpers_SOURCES = \
|
||||
tests/test_multiboot2_info_helpers.c \
|
||||
tests/multiboot2_info_example1.h \
|
||||
tests/multiboot2_info_example2.h
|
||||
endif
|
||||
endif
|
||||
|
||||
####################################
|
||||
# tests/test_multiboot2_info_print #
|
||||
####################################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_MULTIBOOT2
|
||||
TESTS += tests/test_multiboot2_info_print
|
||||
tests_test_multiboot2_info_print_DEPENDENCIES = \
|
||||
tests/multiboot2_info_print1 \
|
||||
tests/multiboot2_info_print2
|
||||
tests_test_multiboot2_info_print_LDADD = libkernaux.a
|
||||
tests_test_multiboot2_info_print_SOURCES = \
|
||||
tests/test_multiboot2_info_print.c
|
||||
endif
|
||||
endif
|
||||
|
||||
#########################################
|
||||
# tests/test_multiboot2_info_validation #
|
||||
#########################################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_MULTIBOOT2
|
||||
TESTS += tests/test_multiboot2_info_validation
|
||||
tests_test_multiboot2_info_validation_LDADD = libkernaux.a
|
||||
tests_test_multiboot2_info_validation_SOURCES = \
|
||||
tests/test_multiboot2_info_validation.c \
|
||||
tests/multiboot2_info_example1.h \
|
||||
tests/multiboot2_info_example2.h
|
||||
endif
|
||||
endif
|
||||
|
||||
###################
|
||||
# tests/test_ntoa #
|
||||
###################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_NTOA
|
||||
TESTS += tests/test_ntoa
|
||||
tests_test_ntoa_LDADD = libkernaux.a
|
||||
tests_test_ntoa_SOURCES = tests/test_ntoa.c
|
||||
endif
|
||||
endif
|
||||
|
||||
##################
|
||||
# tests/test_pfa #
|
||||
##################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_PFA
|
||||
TESTS += tests/test_pfa
|
||||
tests_test_pfa_LDADD = libkernaux.a
|
||||
tests_test_pfa_SOURCES = tests/test_pfa.c
|
||||
endif
|
||||
endif
|
||||
|
||||
#########################
|
||||
# tests/test_pfa_assert #
|
||||
#########################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_PFA
|
||||
TESTS += tests/test_pfa_assert
|
||||
tests_test_pfa_assert_LDADD = libkernaux.a
|
||||
tests_test_pfa_assert_SOURCES = tests/test_pfa_assert.c
|
||||
endif
|
||||
endif
|
||||
|
||||
#############################
|
||||
# tests/test_printf_fmt_gen #
|
||||
#############################
|
||||
|
||||
if ENABLE_TESTS_PYTHON
|
||||
if WITH_PRINTF_FMT
|
||||
TESTS += tests/test_printf_fmt_gen
|
||||
tests_test_printf_fmt_gen_LDADD = libkernaux.a
|
||||
tests_test_printf_fmt_gen_SOURCES = \
|
||||
tests/test_printf_fmt_gen.c \
|
||||
tests/printf_fmt_gen.py \
|
||||
tests/printf_fmt_gen.jinja \
|
||||
common/printf_fmt.yml
|
||||
endif
|
||||
endif
|
||||
|
||||
CLEANFILES += tests/test_printf_fmt_gen.c
|
||||
|
||||
tests/test_printf_fmt_gen.c: tests/printf_fmt_gen.py tests/printf_fmt_gen.jinja common/printf_fmt.yml
|
||||
python3 tests/printf_fmt_gen.py
|
||||
|
||||
#########################
|
||||
# tests/test_printf_gen #
|
||||
#########################
|
||||
|
||||
if ENABLE_TESTS_PYTHON
|
||||
if WITH_PRINTF
|
||||
TESTS += tests/test_printf_gen
|
||||
tests_test_printf_gen_LDADD = libkernaux.a
|
||||
tests_test_printf_gen_SOURCES = \
|
||||
tests/test_printf_gen.c \
|
||||
tests/printf_gen.py \
|
||||
tests/printf_gen.jinja \
|
||||
common/printf.yml \
|
||||
common/printf_orig.yml
|
||||
endif
|
||||
endif
|
||||
|
||||
CLEANFILES += tests/test_printf_gen.c
|
||||
|
||||
tests/test_printf_gen.c: tests/printf_gen.py tests/printf_gen.jinja common/printf.yml common/printf_orig.yml
|
||||
python3 tests/printf_gen.py
|
||||
|
||||
##########################
|
||||
# tests/test_units_human #
|
||||
##########################
|
||||
|
||||
if ENABLE_TESTS
|
||||
if WITH_UNITS
|
||||
TESTS += tests/test_units_human
|
||||
tests_test_units_human_LDADD = libkernaux.a
|
||||
tests_test_units_human_SOURCES = tests/test_units_human.c
|
||||
endif
|
||||
libkernaux_la_SOURCES += src/units.c
|
||||
endif
|
||||
|
|
|
@ -76,6 +76,7 @@ zero). Work-in-progress APIs can change at any time.
|
|||
* [vsnprintf](/examples/snprintf_va.c)
|
||||
* libc replacement
|
||||
* [ctype.h](/libc/include/ctype.h)
|
||||
* [math.h](/libm/include/math.h)
|
||||
* [stdlib.h](/libc/include/stdlib.h)
|
||||
* [string.h](/libc/include/string.h)
|
||||
|
||||
|
@ -95,6 +96,9 @@ stable options.
|
|||
#### Features
|
||||
|
||||
* `--enable-freestanding` - build for freestanding environment
|
||||
* `--enable-split-all` - split off all libraries
|
||||
* `--enable-split-libc` - split off libc
|
||||
* `--enable-split-libm` - split off libm
|
||||
* `--enable-tests` - enable usual tests and examples
|
||||
* `--enable-tests-all` - enable all tests
|
||||
* `--enable-tests-python` - enable tests that require Python 3 with YAML and
|
||||
|
@ -104,6 +108,8 @@ stable options.
|
|||
|
||||
* `--with-libc` - provides the replacement for some standard C functions.
|
||||
Useful in freestanding environment, where no libc is present.
|
||||
* `--with-libm` - provides the replacement for C functions from `<math.h>`,
|
||||
Useful in freestanding environment, where no libm is present.
|
||||
|
||||
### Default options
|
||||
|
||||
|
@ -162,6 +168,7 @@ without it in `$PATH`:
|
|||
--host='i386-elf' \
|
||||
--enable-freestanding \
|
||||
--with-libc \
|
||||
--with-libm \
|
||||
AR="$(which i386-elf-ar)" \
|
||||
CC="$(which i386-elf-gcc)" \
|
||||
RANLIB="$(which i386-elf-ranlib)"
|
||||
|
|
|
@ -14,4 +14,4 @@ export AR="$CROSS-ar"
|
|||
export CC="$CROSS-gcc"
|
||||
export RANLIB="$CROSS-ranlib"
|
||||
|
||||
"$REPO/configure" --host="$HOST" --prefix="$PREFIX" --enable-freestanding --with-libc
|
||||
"$REPO/configure" --host="$HOST" --prefix="$PREFIX" --enable-freestanding --with-libc --with-libm
|
||||
|
|
|
@ -14,4 +14,4 @@ export AR="$CROSS-ar"
|
|||
export CC="$CROSS-gcc"
|
||||
export RANLIB="$CROSS-ranlib"
|
||||
|
||||
"$REPO/configure" --host="$HOST" --prefix="$PREFIX" --enable-freestanding --with-libc
|
||||
"$REPO/configure" --host="$HOST" --prefix="$PREFIX" --enable-freestanding --with-libc --with-libm
|
||||
|
|
|
@ -16,4 +16,4 @@ export RANLIB="$CROSS-ranlib"
|
|||
|
||||
export CFLAGS='-mabi=sysv -mcmodel=kernel -mno-80387 -mno-red-zone'
|
||||
|
||||
"$REPO/configure" --host="$HOST" --prefix="$PREFIX" --enable-freestanding --with-libc
|
||||
"$REPO/configure" --host="$HOST" --prefix="$PREFIX" --enable-freestanding --with-libc --with-libm
|
||||
|
|
|
@ -14,4 +14,4 @@ export AR="$TARGET-ar"
|
|||
export CC="$TARGET-gcc"
|
||||
export RANLIB="$TARGET-ranlib"
|
||||
|
||||
"$REPO/configure" --host="$HOST" --prefix="$PREFIX" --enable-freestanding --with-libc
|
||||
"$REPO/configure" --host="$HOST" --prefix="$PREFIX" --enable-freestanding --with-libc --with-libm
|
||||
|
|
|
@ -14,4 +14,4 @@ export AR="$TARGET-ar"
|
|||
export CC="$TARGET-gcc"
|
||||
export RANLIB="$TARGET-ranlib"
|
||||
|
||||
"$REPO/configure" --host="$HOST" --prefix="$PREFIX" --enable-freestanding --with-libc
|
||||
"$REPO/configure" --host="$HOST" --prefix="$PREFIX" --enable-freestanding --with-libc --with-libm
|
||||
|
|
|
@ -16,4 +16,4 @@ export RANLIB="$TARGET-ranlib"
|
|||
|
||||
export CFLAGS='-mabi=sysv -mcmodel=kernel -mno-80387 -mno-red-zone'
|
||||
|
||||
"$REPO/configure" --host="$HOST" --prefix="$PREFIX" --enable-freestanding --with-libc
|
||||
"$REPO/configure" --host="$HOST" --prefix="$PREFIX" --enable-freestanding --with-libc --with-libm
|
||||
|
|
93
configure.ac
93
configure.ac
|
@ -1,16 +1,42 @@
|
|||
############################
|
||||
# Specify program versions #
|
||||
############################
|
||||
|
||||
AC_PREREQ([2.68])
|
||||
LT_PREREQ([2.4.6])
|
||||
|
||||
|
||||
|
||||
#######################
|
||||
# Initialize Autoconf #
|
||||
#######################
|
||||
|
||||
AC_INIT([libkernaux],
|
||||
[0.3.0],
|
||||
[https://github.com/tailix/libkernaux/issues],
|
||||
[libkernaux],
|
||||
[https://github.com/tailix/libkernaux])
|
||||
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_SRCDIR([src/assert.c])
|
||||
|
||||
AC_CANONICAL_BUILD
|
||||
AC_CANONICAL_HOST
|
||||
|
||||
AC_CONFIG_MACRO_DIRS([m4])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_SRCDIR([src/assert.c])
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
examples/Makefile
|
||||
include/Makefile
|
||||
libc/Makefile
|
||||
libc/include/Makefile
|
||||
libm/Makefile
|
||||
libm/include/Makefile
|
||||
include/kernaux.h
|
||||
include/kernaux/console.h
|
||||
include/kernaux/printf.h
|
||||
tests/Makefile
|
||||
])
|
||||
|
||||
|
||||
|
||||
###############
|
||||
|
@ -23,6 +49,9 @@ AC_ARG_ENABLE([werror], AS_HELP_STRING([--disable-werror], [disable -
|
|||
|
||||
dnl Features (disabled by default)
|
||||
AC_ARG_ENABLE([freestanding], AS_HELP_STRING([--enable-freestanding], [build for freestanding environment]))
|
||||
AC_ARG_ENABLE([split-all], AS_HELP_STRING([--enable-split-all], [split off all libraries]))
|
||||
AC_ARG_ENABLE([split-libc], AS_HELP_STRING([--enable-split-libc], [split off libc]))
|
||||
AC_ARG_ENABLE([split-libm], AS_HELP_STRING([--enable-split-libm], [split off libm]))
|
||||
AC_ARG_ENABLE([tests], AS_HELP_STRING([--enable-tests], [enable usual tests and examples]))
|
||||
AC_ARG_ENABLE([tests-all], AS_HELP_STRING([--enable-tests-all], [enable all tests]))
|
||||
AC_ARG_ENABLE([tests-python], AS_HELP_STRING([--enable-tests-python], [enable tests that require Python 3 with YAML and Jinja2]))
|
||||
|
@ -44,6 +73,7 @@ AC_ARG_WITH( [units], AS_HELP_STRING([--without-units], [without m
|
|||
|
||||
dnl Packages (disabled by default)
|
||||
AC_ARG_WITH( [libc], AS_HELP_STRING([--with-libc], [with libc replacement]))
|
||||
AC_ARG_WITH( [libm], AS_HELP_STRING([--with-libm], [with libm replacement]))
|
||||
|
||||
|
||||
|
||||
|
@ -51,6 +81,13 @@ AC_ARG_WITH( [libc], AS_HELP_STRING([--with-libc], [with libc
|
|||
# Default args #
|
||||
################
|
||||
|
||||
AC_DEFUN([do_enable_split_all],
|
||||
[
|
||||
if test -z "$enable_split_libc"; then enable_split_libc=yes; fi
|
||||
if test -z "$enable_split_libm"; then enable_split_libm=yes; fi
|
||||
])
|
||||
AS_IF([test "$enable_split_all" = yes], do_enable_split_all)
|
||||
|
||||
AC_DEFUN([do_enable_tests_all],
|
||||
[
|
||||
if test -z "$enable_tests"; then enable_tests=yes; fi
|
||||
|
@ -87,6 +124,9 @@ AS_IF([test "$enable_werror" = no ], [enable_werror=no], [enable_we
|
|||
|
||||
dnl Features (disabled by default)
|
||||
AS_IF([test "$enable_freestanding" = yes], [enable_freestanding=yes], [enable_freestanding=no])
|
||||
AS_IF([test "$enable_split_all" = yes], [enable_split_all=yes], [enable_split_all=no])
|
||||
AS_IF([test "$enable_split_libc" = yes], [enable_split_libc=yes], [enable_split_libc=no])
|
||||
AS_IF([test "$enable_split_libm" = yes], [enable_split_libm=yes], [enable_split_libm=no])
|
||||
AS_IF([test "$enable_tests" = yes], [enable_tests=yes], [enable_tests=no])
|
||||
AS_IF([test "$enable_tests_all" = yes], [enable_tests_all=yes], [enable_tests_all=no])
|
||||
AS_IF([test "$enable_tests_python" = yes], [enable_tests_python=yes], [enable_tests_python=no])
|
||||
|
@ -108,6 +148,7 @@ AS_IF([test "$with_units" = no ], [with_units=no], [with_unit
|
|||
|
||||
dnl Packages (disabled by default)
|
||||
AS_IF([test "$with_libc" = yes], [with_libc=yes], [with_libc=no])
|
||||
AS_IF([test "$with_libm" = yes], [with_libm=yes], [with_libm=no])
|
||||
|
||||
|
||||
|
||||
|
@ -121,6 +162,8 @@ AS_IF([test "$enable_tests" = yes -a "$enable_freestanding" = yes], AC_MS
|
|||
AS_IF([test "$enable_tests_python" = yes -a "$enable_freestanding" = yes], AC_MSG_ERROR([can not build freestanding tests]))
|
||||
AS_IF([test "$enable_tests" = yes -a "$with_libc" = yes], AC_MSG_ERROR([can not use package `libc' with tests]))
|
||||
AS_IF([test "$enable_tests_python" = yes -a "$with_libc" = yes], AC_MSG_ERROR([can not use package `libc' with tests]))
|
||||
AS_IF([test "$enable_tests" = yes -a "$with_libm" = yes], AC_MSG_ERROR([can not use package `libm' with tests]))
|
||||
AS_IF([test "$enable_tests_python" = yes -a "$with_libm" = yes], AC_MSG_ERROR([can not use package `libm' with tests]))
|
||||
|
||||
AS_IF([test "$with_printf" = yes -a "$with_ntoa" = no], AC_MSG_ERROR([package `printf' requires package `ntoa']))
|
||||
AS_IF([test "$with_printf" = yes -a "$with_printf_fmt" = no], AC_MSG_ERROR([package `printf' requires package `printf-fmt']))
|
||||
|
@ -143,6 +186,8 @@ AM_CONDITIONAL([ENABLE_WERROR], [test "$enable_werror" = yes])
|
|||
|
||||
dnl Features (disabled by default)
|
||||
AM_CONDITIONAL([ENABLE_FREESTANDING], [test "$enable_freestanding" = yes])
|
||||
AM_CONDITIONAL([ENABLE_SPLIT_LIBC], [test "$enable_split_libc" = yes])
|
||||
AM_CONDITIONAL([ENABLE_SPLIT_LIBM], [test "$enable_split_libm" = yes])
|
||||
AM_CONDITIONAL([ENABLE_TESTS], [test "$enable_tests" = yes])
|
||||
AM_CONDITIONAL([ENABLE_TESTS_PYTHON], [test "$enable_tests_python" = yes])
|
||||
|
||||
|
@ -162,6 +207,7 @@ AM_CONDITIONAL([WITH_UNITS], [test "$with_units" = yes])
|
|||
|
||||
dnl Packages (disabled by default)
|
||||
AM_CONDITIONAL([WITH_LIBC], [test "$with_libc" = yes])
|
||||
AM_CONDITIONAL([WITH_LIBM], [test "$with_libm" = yes])
|
||||
|
||||
|
||||
|
||||
|
@ -179,6 +225,8 @@ AS_IF([test "$enable_float" = yes], [AC_DEFINE([ENABLE_FLOAT], [1]
|
|||
AS_IF([test "$enable_werror" = yes], [AC_DEFINE([ENABLE_WERROR], [1], [enabled -Werror])])
|
||||
|
||||
dnl Features (disabled by default)
|
||||
AS_IF([test "$enable_split_libc" = yes], [AC_DEFINE([ENABLE_SPLIT_LIBC], [1], [split off libc])])
|
||||
AS_IF([test "$enable_split_libm" = yes], [AC_DEFINE([ENABLE_SPLIT_LIBM], [1], [split off libm])])
|
||||
AS_IF([test "$enable_freestanding" = yes], [AC_DEFINE([ENABLE_FREESTANDING], [1], [build for freestanding environment])])
|
||||
AS_IF([test "$enable_tests" = yes], [AC_DEFINE([ENABLE_TESTS], [1], [enabled usual tests and examples])])
|
||||
AS_IF([test "$enable_tests_python" = yes], [AC_DEFINE([ENABLE_TESTS_PYTHON], [1], [enabled tests that require Python 3 with YAML and Jinja2])])
|
||||
|
@ -198,7 +246,8 @@ AS_IF([test "$with_printf_fmt" = yes], [AC_DEFINE([WITH_PRINTF_FMT], [1]
|
|||
AS_IF([test "$with_units", = yes], [AC_DEFINE([WITH_UNITS], [1], [with measurement units utils])])
|
||||
|
||||
dnl Packages (disabled by default)
|
||||
AS_IF([test "$with_libc" = yes], [AC_DEFINE([WITH_LIBC], [1], [with atoi replacement])])
|
||||
AS_IF([test "$with_libc" = yes], [AC_DEFINE([WITH_LIBC], [1], [with libc replacement])])
|
||||
AS_IF([test "$with_libm" = yes], [AC_DEFINE([WITH_LIBM], [1], [with libm replacement])])
|
||||
|
||||
|
||||
|
||||
|
@ -222,22 +271,27 @@ AS_IF([test "$with_units" = no], [AC_SUBST([comment_line_units], [
|
|||
|
||||
|
||||
|
||||
###################
|
||||
# Set build flags #
|
||||
###################
|
||||
|
||||
AC_DEFUN([do_enable_freestanding], [CFLAGS+=' -nostdlib -ffreestanding -fno-pic -fno-stack-protector '])
|
||||
AC_DEFUN([do_disable_freestanding], [CFLAGS+=' -fpic '])
|
||||
AS_IF([test "$enable_freestanding" = yes], do_enable_freestanding, do_disable_freestanding)
|
||||
|
||||
|
||||
|
||||
#######################
|
||||
# Initialize Automake #
|
||||
#######################
|
||||
|
||||
AM_INIT_AUTOMAKE([1.16 subdir-objects])
|
||||
|
||||
AC_CONFIG_FILES([
|
||||
Makefile
|
||||
include/Makefile
|
||||
libc/include/Makefile
|
||||
include/kernaux.h
|
||||
include/kernaux/console.h
|
||||
include/kernaux/printf.h
|
||||
])
|
||||
|
||||
|
||||
##############
|
||||
# Run checks #
|
||||
##############
|
||||
|
||||
AC_LANG([C])
|
||||
|
||||
|
@ -245,9 +299,22 @@ AM_PROG_AR
|
|||
AM_PROG_AS
|
||||
AC_PROG_CC
|
||||
AC_PROG_CC_C99
|
||||
AC_PROG_RANLIB
|
||||
AC_C_INLINE
|
||||
AC_CHECK_HEADER_STDBOOL
|
||||
AC_CHECK_HEADERS([stdarg.h stddef.h stdint.h])
|
||||
|
||||
|
||||
|
||||
######################
|
||||
# Initialize Libtool #
|
||||
######################
|
||||
|
||||
LT_INIT([disable-shared])
|
||||
|
||||
|
||||
|
||||
##########
|
||||
# Finish #
|
||||
##########
|
||||
|
||||
AC_OUTPUT
|
||||
|
|
2
examples/.gitignore
vendored
Normal file
2
examples/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/Makefile
|
||||
/Makefile.in
|
130
examples/Makefile.am
Normal file
130
examples/Makefile.am
Normal file
|
@ -0,0 +1,130 @@
|
|||
include $(top_srcdir)/shared.am
|
||||
|
||||
TESTS =
|
||||
noinst_PROGRAMS = $(TESTS)
|
||||
|
||||
#################
|
||||
# assert_guards #
|
||||
#################
|
||||
|
||||
TESTS += assert_guards
|
||||
assert_guards_LDADD = $(top_builddir)/libkernaux.la
|
||||
assert_guards_SOURCES = assert_guards.c
|
||||
|
||||
#################
|
||||
# assert_simple #
|
||||
#################
|
||||
|
||||
TESTS += assert_simple
|
||||
assert_simple_LDADD = $(top_builddir)/libkernaux.la
|
||||
assert_simple_SOURCES = assert_simple.c
|
||||
|
||||
###########
|
||||
# cmdline #
|
||||
###########
|
||||
|
||||
if WITH_CMDLINE
|
||||
TESTS += cmdline
|
||||
cmdline_LDADD = $(top_builddir)/libkernaux.la
|
||||
cmdline_SOURCES = cmdline.c
|
||||
endif
|
||||
|
||||
###########
|
||||
# fprintf #
|
||||
###########
|
||||
|
||||
if WITH_PRINTF
|
||||
if WITH_FILE
|
||||
TESTS += fprintf
|
||||
fprintf_LDADD = $(top_builddir)/libkernaux.la
|
||||
fprintf_SOURCES = fprintf.c
|
||||
endif
|
||||
endif
|
||||
|
||||
##############
|
||||
# fprintf_va #
|
||||
##############
|
||||
|
||||
if WITH_PRINTF
|
||||
if WITH_FILE
|
||||
TESTS += fprintf_va
|
||||
fprintf_va_LDADD = $(top_builddir)/libkernaux.la
|
||||
fprintf_va_SOURCES = fprintf_va.c
|
||||
endif
|
||||
endif
|
||||
|
||||
########
|
||||
# ntoa #
|
||||
########
|
||||
|
||||
if WITH_NTOA
|
||||
TESTS += ntoa
|
||||
ntoa_LDADD = $(top_builddir)/libkernaux.la
|
||||
ntoa_SOURCES = ntoa.c
|
||||
endif
|
||||
|
||||
################
|
||||
# panic_guards #
|
||||
################
|
||||
|
||||
TESTS += panic_guards
|
||||
panic_guards_LDADD = $(top_builddir)/libkernaux.la
|
||||
panic_guards_SOURCES = panic_guards.c
|
||||
|
||||
################
|
||||
# panic_simple #
|
||||
################
|
||||
|
||||
TESTS += panic_simple
|
||||
panic_simple_LDADD = $(top_builddir)/libkernaux.la
|
||||
panic_simple_SOURCES = panic_simple.c
|
||||
|
||||
#######
|
||||
# pfa #
|
||||
#######
|
||||
|
||||
if WITH_PFA
|
||||
TESTS += pfa
|
||||
pfa_LDADD = $(top_builddir)/libkernaux.la
|
||||
pfa_SOURCES = pfa.c
|
||||
endif
|
||||
|
||||
##############
|
||||
# printf_fmt #
|
||||
##############
|
||||
|
||||
if WITH_PRINTF_FMT
|
||||
TESTS += printf_fmt
|
||||
printf_fmt_LDADD = $(top_builddir)/libkernaux.la
|
||||
printf_fmt_SOURCES = printf_fmt.c
|
||||
endif
|
||||
|
||||
############
|
||||
# snprintf #
|
||||
############
|
||||
|
||||
if WITH_PRINTF
|
||||
TESTS += snprintf
|
||||
snprintf_LDADD = $(top_builddir)/libkernaux.la
|
||||
snprintf_SOURCES = snprintf.c
|
||||
endif
|
||||
|
||||
###############
|
||||
# snprintf_va #
|
||||
###############
|
||||
|
||||
if WITH_PRINTF
|
||||
TESTS += snprintf_va
|
||||
snprintf_va_LDADD = $(top_builddir)/libkernaux.la
|
||||
snprintf_va_SOURCES = snprintf_va.c
|
||||
endif
|
||||
|
||||
###############
|
||||
# units_human #
|
||||
###############
|
||||
|
||||
if WITH_UNITS
|
||||
TESTS += units_human
|
||||
units_human_LDADD = $(top_builddir)/libkernaux.la
|
||||
units_human_SOURCES = units_human.c
|
||||
endif
|
|
@ -34,9 +34,7 @@ $(KERNEL): $(LINKERSCR) $(OBJS) build-libkernaux.a
|
|||
$(CC) -T $(LINKERSCR) -o $@ $(OBJS) -nostdlib -lkernaux -lgcc -Wl,-L$(LIBKERNAUX_DEST)/lib
|
||||
|
||||
build-libkernaux.a:
|
||||
cd $(LIBKERNAUX_BUILD) && ./config
|
||||
cd $(LIBKERNAUX_BUILD) && make libkernaux.a
|
||||
cd $(LIBKERNAUX_BUILD) && make install-data install-exec
|
||||
cd $(LIBKERNAUX_BUILD) && ./config && make install
|
||||
|
||||
%.c.o: %.c
|
||||
$(CC) -c $< -o $@ $(CFLAGS)
|
||||
|
|
|
@ -53,9 +53,7 @@ $(KERNEL): $(LINKERSCR) build-libkernaux.a $(OBJS)
|
|||
$(GRUB_FILE) --is-x86-multiboot2 $@
|
||||
|
||||
build-libkernaux.a:
|
||||
cd $(LIBKERNAUX_BUILD) && ./config
|
||||
cd $(LIBKERNAUX_BUILD) && make libkernaux.a
|
||||
cd $(LIBKERNAUX_BUILD) && make install-data install-exec
|
||||
cd $(LIBKERNAUX_BUILD) && ./config && make install
|
||||
|
||||
%.c.o: %.c
|
||||
$(CC) -c $< -o $@ $(CFLAGS)
|
||||
|
|
|
@ -78,9 +78,7 @@ $(FULL_LIMINE_SYS):
|
|||
cp -f $(LIMINE_SYS) $(FULL_LIMINE_SYS)
|
||||
|
||||
build-libkernaux.a:
|
||||
cd $(LIBKERNAUX_BUILD) && ./config
|
||||
cd $(LIBKERNAUX_BUILD) && make libkernaux.a
|
||||
cd $(LIBKERNAUX_BUILD) && make install-data install-exec
|
||||
cd $(LIBKERNAUX_BUILD) && ./config && make install
|
||||
|
||||
%.c.o: %.c
|
||||
$(CC) -c $< -o $@ $(CFLAGS)
|
||||
|
|
|
@ -82,9 +82,7 @@ $(FULL_LIMINE_SYS):
|
|||
cp -f $(LIMINE_SYS) $(FULL_LIMINE_SYS)
|
||||
|
||||
build-libkernaux.a:
|
||||
cd $(LIBKERNAUX_BUILD) && ./config
|
||||
cd $(LIBKERNAUX_BUILD) && make libkernaux.a
|
||||
cd $(LIBKERNAUX_BUILD) && make install-data install-exec
|
||||
cd $(LIBKERNAUX_BUILD) && ./config && make install
|
||||
|
||||
%.c.o: %.c
|
||||
$(CC) -c $< -o $@ $(CFLAGS)
|
||||
|
|
4
libc/.gitignore
vendored
Normal file
4
libc/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
/Makefile
|
||||
/Makefile.in
|
||||
/include/Makefile
|
||||
/include/Makefile.in
|
14
libc/Makefile.am
Normal file
14
libc/Makefile.am
Normal file
|
@ -0,0 +1,14 @@
|
|||
include $(top_srcdir)/shared.am
|
||||
|
||||
SUBDIRS = include
|
||||
|
||||
if ENABLE_SPLIT_LIBC
|
||||
lib_LTLIBRARIES = libc.la
|
||||
else
|
||||
EXTRA_LTLIBRARIES = libc.la
|
||||
endif
|
||||
|
||||
libc_la_SOURCES = \
|
||||
src/ctype.c \
|
||||
src/stdlib.c \
|
||||
src/string.c
|
|
@ -1,6 +1,4 @@
|
|||
if WITH_LIBC
|
||||
nobase_include_HEADERS = \
|
||||
ctype.h \
|
||||
stdlib.h \
|
||||
string.h
|
||||
endif
|
||||
|
|
4
libm/.gitignore
vendored
Normal file
4
libm/.gitignore
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
/Makefile
|
||||
/Makefile.in
|
||||
/include/Makefile
|
||||
/include/Makefile.in
|
11
libm/Makefile.am
Normal file
11
libm/Makefile.am
Normal file
|
@ -0,0 +1,11 @@
|
|||
include $(top_srcdir)/shared.am
|
||||
|
||||
SUBDIRS = include
|
||||
|
||||
if ENABLE_SPLIT_LIBM
|
||||
lib_LTLIBRARIES = libm.la
|
||||
else
|
||||
EXTRA_LTLIBRARIES = libm.la
|
||||
endif
|
||||
|
||||
libm_la_SOURCES = src/main.c
|
1
libm/include/Makefile.am
Normal file
1
libm/include/Makefile.am
Normal file
|
@ -0,0 +1 @@
|
|||
nobase_include_HEADERS = math.h
|
12
libm/include/math.h
Normal file
12
libm/include/math.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#ifndef _MATH_H
|
||||
#define _MATH_H 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
8
libm/src/main.c
Normal file
8
libm/src/main.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
__attribute__((unused))
|
||||
static const int foobar = 0;
|
0
m4/.keep
Normal file
0
m4/.keep
Normal file
33
shared.am
Normal file
33
shared.am
Normal file
|
@ -0,0 +1,33 @@
|
|||
# vim: set syntax=automake:
|
||||
|
||||
AM_CFLAGS = \
|
||||
-std=c99 \
|
||||
-pedantic \
|
||||
-Wall \
|
||||
-Wextra \
|
||||
-I$(top_builddir)/include \
|
||||
-I$(top_srcdir)/include \
|
||||
-D_POSIX_C_SOURCE=200809L
|
||||
|
||||
if WITH_LIBC
|
||||
AM_CFLAGS += \
|
||||
-I$(top_builddir)/libc/include \
|
||||
-I$(top_srcdir)/libc/include
|
||||
endif
|
||||
|
||||
if WITH_LIBM
|
||||
AM_CFLAGS += \
|
||||
-I$(top_builddir)/libm/include \
|
||||
-I$(top_srcdir)/libm/include
|
||||
endif
|
||||
|
||||
if ENABLE_WERROR
|
||||
AM_CFLAGS += -Werror
|
||||
endif
|
||||
|
||||
# TODO: DRY (configure.ac)
|
||||
if ENABLE_FREESTANDING
|
||||
AM_CFLAGS += -nostdlib -ffreestanding -fno-pic -fno-stack-protector
|
||||
else
|
||||
AM_CFLAGS += -fpic
|
||||
endif
|
2
tests/.gitignore
vendored
Normal file
2
tests/.gitignore
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
/Makefile
|
||||
/Makefile.in
|
265
tests/Makefile.am
Normal file
265
tests/Makefile.am
Normal file
|
@ -0,0 +1,265 @@
|
|||
include $(top_srcdir)/shared.am
|
||||
|
||||
CLEANFILES =
|
||||
TESTS =
|
||||
noinst_PROGRAMS = $(TESTS)
|
||||
|
||||
############################
|
||||
# multiboot2_header_print1 #
|
||||
############################
|
||||
|
||||
if WITH_MULTIBOOT2
|
||||
noinst_PROGRAMS += multiboot2_header_print1
|
||||
multiboot2_header_print1_LDADD = $(top_builddir)/libkernaux.la
|
||||
multiboot2_header_print1_SOURCES = \
|
||||
multiboot2_header_print1.c \
|
||||
multiboot2_header_example1.h
|
||||
endif
|
||||
|
||||
############################
|
||||
# multiboot2_header_print2 #
|
||||
############################
|
||||
|
||||
if WITH_MULTIBOOT2
|
||||
noinst_PROGRAMS += multiboot2_header_print2
|
||||
multiboot2_header_print2_LDADD = $(top_builddir)/libkernaux.la
|
||||
multiboot2_header_print2_SOURCES = \
|
||||
multiboot2_header_print2.c \
|
||||
multiboot2_header_example2.h
|
||||
endif
|
||||
|
||||
##########################
|
||||
# multiboot2_info_print1 #
|
||||
##########################
|
||||
|
||||
if WITH_MULTIBOOT2
|
||||
noinst_PROGRAMS += multiboot2_info_print1
|
||||
multiboot2_info_print1_LDADD = $(top_builddir)/libkernaux.la
|
||||
multiboot2_info_print1_SOURCES = \
|
||||
multiboot2_info_print1.c \
|
||||
multiboot2_info_example1.h
|
||||
endif
|
||||
|
||||
##########################
|
||||
# multiboot2_info_print2 #
|
||||
##########################
|
||||
|
||||
if WITH_MULTIBOOT2
|
||||
noinst_PROGRAMS += multiboot2_info_print2
|
||||
multiboot2_info_print2_LDADD = $(top_builddir)/libkernaux.la
|
||||
multiboot2_info_print2_SOURCES = \
|
||||
multiboot2_info_print2.c \
|
||||
multiboot2_info_example2.h
|
||||
endif
|
||||
|
||||
################
|
||||
# test_cmdline #
|
||||
################
|
||||
|
||||
if WITH_CMDLINE
|
||||
TESTS += test_cmdline
|
||||
test_cmdline_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_cmdline_SOURCES = test_cmdline.c
|
||||
endif
|
||||
|
||||
####################
|
||||
# test_cmdline_gen #
|
||||
####################
|
||||
|
||||
if ENABLE_TESTS_PYTHON
|
||||
if WITH_CMDLINE
|
||||
TESTS += test_cmdline_gen
|
||||
test_cmdline_gen_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_cmdline_gen_SOURCES = \
|
||||
test_cmdline_gen.c \
|
||||
cmdline_gen.py \
|
||||
cmdline_gen.jinja \
|
||||
$(top_srcdir)/common/cmdline.yml
|
||||
endif
|
||||
endif
|
||||
|
||||
CLEANFILES += test_cmdline_gen.c
|
||||
|
||||
test_cmdline_gen.c: cmdline_gen.py cmdline_gen.jinja $(top_srcdir)/common/cmdline.yml
|
||||
python3 cmdline_gen.py
|
||||
|
||||
############
|
||||
# test_elf #
|
||||
############
|
||||
|
||||
if WITH_ELF
|
||||
TESTS += test_elf
|
||||
test_elf_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_elf_SOURCES = test_elf.c
|
||||
endif
|
||||
|
||||
############
|
||||
# test_mbr #
|
||||
############
|
||||
|
||||
if WITH_MBR
|
||||
TESTS += test_mbr
|
||||
test_mbr_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_mbr_SOURCES = test_mbr.c
|
||||
endif
|
||||
|
||||
##################################
|
||||
# test_multiboot2_header_helpers #
|
||||
##################################
|
||||
|
||||
if WITH_MULTIBOOT2
|
||||
TESTS += test_multiboot2_header_helpers
|
||||
test_multiboot2_header_helpers_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_multiboot2_header_helpers_SOURCES = \
|
||||
test_multiboot2_header_helpers.c \
|
||||
multiboot2_header_example1.h \
|
||||
multiboot2_header_example2.h
|
||||
endif
|
||||
|
||||
################################
|
||||
# test_multiboot2_header_print #
|
||||
################################
|
||||
|
||||
if WITH_MULTIBOOT2
|
||||
TESTS += test_multiboot2_header_print
|
||||
test_multiboot2_header_print_DEPENDENCIES = \
|
||||
multiboot2_header_print1 \
|
||||
multiboot2_header_print2
|
||||
test_multiboot2_header_print_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_multiboot2_header_print_SOURCES = test_multiboot2_header_print.c
|
||||
endif
|
||||
|
||||
#####################################
|
||||
# test_multiboot2_header_validation #
|
||||
#####################################
|
||||
|
||||
if WITH_MULTIBOOT2
|
||||
TESTS += test_multiboot2_header_validation
|
||||
test_multiboot2_header_validation_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_multiboot2_header_validation_SOURCES = \
|
||||
test_multiboot2_header_validation.c \
|
||||
multiboot2_header_example1.h \
|
||||
multiboot2_header_example2.h
|
||||
endif
|
||||
|
||||
################################
|
||||
# test_multiboot2_info_helpers #
|
||||
################################
|
||||
|
||||
if WITH_MULTIBOOT2
|
||||
TESTS += test_multiboot2_info_helpers
|
||||
test_multiboot2_info_helpers_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_multiboot2_info_helpers_SOURCES = \
|
||||
test_multiboot2_info_helpers.c \
|
||||
multiboot2_info_example1.h \
|
||||
multiboot2_info_example2.h
|
||||
endif
|
||||
|
||||
##############################
|
||||
# test_multiboot2_info_print #
|
||||
##############################
|
||||
|
||||
if WITH_MULTIBOOT2
|
||||
TESTS += test_multiboot2_info_print
|
||||
test_multiboot2_info_print_DEPENDENCIES = \
|
||||
multiboot2_info_print1 \
|
||||
multiboot2_info_print2
|
||||
test_multiboot2_info_print_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_multiboot2_info_print_SOURCES = test_multiboot2_info_print.c
|
||||
endif
|
||||
|
||||
###################################
|
||||
# test_multiboot2_info_validation #
|
||||
###################################
|
||||
|
||||
if WITH_MULTIBOOT2
|
||||
TESTS += test_multiboot2_info_validation
|
||||
test_multiboot2_info_validation_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_multiboot2_info_validation_SOURCES = \
|
||||
test_multiboot2_info_validation.c \
|
||||
multiboot2_info_example1.h \
|
||||
multiboot2_info_example2.h
|
||||
endif
|
||||
|
||||
#############
|
||||
# test_ntoa #
|
||||
#############
|
||||
|
||||
if WITH_NTOA
|
||||
TESTS += test_ntoa
|
||||
test_ntoa_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_ntoa_SOURCES = test_ntoa.c
|
||||
endif
|
||||
|
||||
############
|
||||
# test_pfa #
|
||||
############
|
||||
|
||||
if WITH_PFA
|
||||
TESTS += test_pfa
|
||||
test_pfa_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_pfa_SOURCES = test_pfa.c
|
||||
endif
|
||||
|
||||
###################
|
||||
# test_pfa_assert #
|
||||
###################
|
||||
|
||||
if WITH_PFA
|
||||
TESTS += test_pfa_assert
|
||||
test_pfa_assert_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_pfa_assert_SOURCES = test_pfa_assert.c
|
||||
endif
|
||||
|
||||
#######################
|
||||
# test_printf_fmt_gen #
|
||||
#######################
|
||||
|
||||
if ENABLE_TESTS_PYTHON
|
||||
if WITH_PRINTF_FMT
|
||||
TESTS += test_printf_fmt_gen
|
||||
test_printf_fmt_gen_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_printf_fmt_gen_SOURCES = \
|
||||
test_printf_fmt_gen.c \
|
||||
printf_fmt_gen.py \
|
||||
printf_fmt_gen.jinja \
|
||||
$(top_srcdir)/common/printf_fmt.yml
|
||||
endif
|
||||
endif
|
||||
|
||||
CLEANFILES += test_printf_fmt_gen.c
|
||||
|
||||
test_printf_fmt_gen.c: printf_fmt_gen.py printf_fmt_gen.jinja $(top_srcdir)/common/printf_fmt.yml
|
||||
python3 printf_fmt_gen.py
|
||||
|
||||
###################
|
||||
# test_printf_gen #
|
||||
###################
|
||||
|
||||
if ENABLE_TESTS_PYTHON
|
||||
if WITH_PRINTF
|
||||
TESTS += test_printf_gen
|
||||
test_printf_gen_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_printf_gen_SOURCES = \
|
||||
test_printf_gen.c \
|
||||
printf_gen.py \
|
||||
printf_gen.jinja \
|
||||
$(top_srcdir)/common/printf.yml \
|
||||
$(top_srcdir)/common/printf_orig.yml
|
||||
endif
|
||||
endif
|
||||
|
||||
CLEANFILES += test_printf_gen.c
|
||||
|
||||
test_printf_gen.c: printf_gen.py printf_gen.jinja $(top_srcdir)/common/printf.yml $(top_srcdir)/common/printf_orig.yml
|
||||
python3 printf_gen.py
|
||||
|
||||
####################
|
||||
# test_units_human #
|
||||
####################
|
||||
|
||||
if WITH_UNITS
|
||||
TESTS += test_units_human
|
||||
test_units_human_LDADD = $(top_builddir)/libkernaux.la
|
||||
test_units_human_SOURCES = test_units_human.c
|
||||
endif
|
|
@ -74,7 +74,7 @@ static const char output2[] =
|
|||
int main()
|
||||
{
|
||||
{
|
||||
FILE *const fd = popen("tests/multiboot2_header_print1", "r");
|
||||
FILE *const fd = popen("./multiboot2_header_print1", "r");
|
||||
assert(fd != NULL);
|
||||
|
||||
for (const char *ch = output1; *ch; ++ch) {
|
||||
|
@ -86,7 +86,7 @@ int main()
|
|||
}
|
||||
|
||||
{
|
||||
FILE *const fd = popen("tests/multiboot2_header_print2", "r");
|
||||
FILE *const fd = popen("./multiboot2_header_print2", "r");
|
||||
assert(fd != NULL);
|
||||
|
||||
for (const char *ch = output2; *ch; ++ch) {
|
||||
|
|
|
@ -271,7 +271,7 @@ static const char output2[] =
|
|||
int main()
|
||||
{
|
||||
{
|
||||
FILE *const fd = popen("tests/multiboot2_info_print1", "r");
|
||||
FILE *const fd = popen("./multiboot2_info_print1", "r");
|
||||
assert(fd != NULL);
|
||||
|
||||
for (const char *ch = output1; *ch; ++ch) {
|
||||
|
@ -283,7 +283,7 @@ int main()
|
|||
}
|
||||
|
||||
{
|
||||
FILE *const fd = popen("tests/multiboot2_info_print2", "r");
|
||||
FILE *const fd = popen("./multiboot2_info_print2", "r");
|
||||
assert(fd != NULL);
|
||||
|
||||
for (const char *ch = output2; *ch; ++ch) {
|
||||
|
|
Loading…
Reference in a new issue