mirror of
https://github.com/tailix/libkernaux.git
synced 2024-12-11 11:35:27 -05:00
Main: fix conditional build - generate headers
This commit is contained in:
parent
13bc3d166a
commit
7704e16592
9 changed files with 60 additions and 28 deletions
2
.github/workflows/ruby.yml
vendored
2
.github/workflows/ruby.yml
vendored
|
@ -39,6 +39,8 @@ jobs:
|
||||||
|
|
||||||
cond:
|
cond:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
SKIP_COVERAGE: x
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- uses: ruby/setup-ruby@v1
|
- uses: ruby/setup-ruby@v1
|
||||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -81,6 +81,8 @@
|
||||||
|
|
||||||
/Makefile
|
/Makefile
|
||||||
/include/Makefile
|
/include/Makefile
|
||||||
|
/include/kernaux.h
|
||||||
|
/include/kernaux/console.h
|
||||||
|
|
||||||
/examples/*.log
|
/examples/*.log
|
||||||
/examples/*.trs
|
/examples/*.trs
|
||||||
|
|
|
@ -6,6 +6,7 @@ AM_CFLAGS = \
|
||||||
-Wall \
|
-Wall \
|
||||||
-Wextra \
|
-Wextra \
|
||||||
-Wno-cast-function-type \
|
-Wno-cast-function-type \
|
||||||
|
-I$(top_builddir)/include \
|
||||||
-I$(top_srcdir)/include
|
-I$(top_srcdir)/include
|
||||||
|
|
||||||
lib_LIBRARIES = libkernaux.a
|
lib_LIBRARIES = libkernaux.a
|
||||||
|
|
30
configure.ac
30
configure.ac
|
@ -151,11 +151,41 @@ AS_IF([test "$with_libc_strnlen" = yes], [AC_DEFINE([WITH_LIBC_STRNLEN], [1]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dnl Architecture
|
||||||
|
AS_IF([test "$host_cpu" != i386], [AC_SUBST([comment_line_asm_i386], [//])])
|
||||||
|
AS_IF([test "$host_cpu" != riscv64], [AC_SUBST([comment_line_asm_riscv64], [//])])
|
||||||
|
AS_IF([test "$host_cpu" != x86_64], [AC_SUBST([comment_line_asm_x86_64], [//])])
|
||||||
|
|
||||||
|
dnl Packages (enabled by default)
|
||||||
|
AS_IF([test "$with_cmdline" = no], [AC_SUBST([comment_line_cmdline], [//])])
|
||||||
|
AS_IF([test "$with_console" = no], [AC_SUBST([comment_line_console], [//])])
|
||||||
|
AS_IF([test "$with_elf" = no], [AC_SUBST([comment_line_elf], [//])])
|
||||||
|
AS_IF([test "$with_framebuffer" = no], [AC_SUBST([comment_line_framebuffer], [//])])
|
||||||
|
AS_IF([test "$with_mbr" = no], [AC_SUBST([comment_line_mbr], [//])])
|
||||||
|
AS_IF([test "$with_multiboot2" = no], [AC_SUBST([comment_line_multiboot2], [//])])
|
||||||
|
AS_IF([test "$with_ntoa" = no], [AC_SUBST([comment_line_ntoa], [//])])
|
||||||
|
AS_IF([test "$with_pfa" = no], [AC_SUBST([comment_line_pfa], [//])])
|
||||||
|
AS_IF([test "$with_printf" = no], [AC_SUBST([comment_line_printf], [//])])
|
||||||
|
AS_IF([test "$with_units" = no], [AC_SUBST([comment_line_units], [//])])
|
||||||
|
|
||||||
|
dnl Packages (disabled by default)
|
||||||
|
AS_IF([test "$with_libc_atoi" != yes], [AC_SUBST([comment_line_libc_atoi], [//])])
|
||||||
|
AS_IF([test "$with_libc_isdigit" != yes], [AC_SUBST([comment_line_libc_isdigit], [//])])
|
||||||
|
AS_IF([test "$with_libc_isspace" != yes], [AC_SUBST([comment_line_libc_isspace], [//])])
|
||||||
|
AS_IF([test "$with_libc_memset" != yes], [AC_SUBST([comment_line_libc_memset], [//])])
|
||||||
|
AS_IF([test "$with_libc_strcpy" != yes], [AC_SUBST([comment_line_libc_strcpy], [//])])
|
||||||
|
AS_IF([test "$with_libc_strlen" != yes], [AC_SUBST([comment_line_libc_strlen], [//])])
|
||||||
|
AS_IF([test "$with_libc_strnlen" != yes], [AC_SUBST([comment_line_libc_strnlen], [//])])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.9 subdir-objects])
|
AM_INIT_AUTOMAKE([1.9 subdir-objects])
|
||||||
|
|
||||||
AC_CONFIG_FILES([
|
AC_CONFIG_FILES([
|
||||||
Makefile
|
Makefile
|
||||||
include/Makefile
|
include/Makefile
|
||||||
|
include/kernaux.h
|
||||||
|
include/kernaux/console.h
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_LANG([C])
|
AC_LANG([C])
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
## TODO: <kernaux.h> is partially conditional because other files are
|
|
||||||
## TODO: <kernaux/libc.h> and <kernaux/console.h> are partially conditional
|
|
||||||
|
|
||||||
nobase_include_HEADERS = \
|
nobase_include_HEADERS = \
|
||||||
kernaux.h \
|
kernaux.h \
|
||||||
kernaux/arch/i386.h \
|
kernaux/arch/i386.h \
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
/*
|
|
||||||
We don't include <kernaux/asm/*.h> because they
|
|
||||||
contain architecture-specific assembly functions.
|
|
||||||
|
|
||||||
We don't include <kernaux/libc.h> because it may
|
|
||||||
conflict with actual freestanding or hosted libc.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <kernaux/assert.h>
|
|
||||||
#include <kernaux/cmdline.h>
|
|
||||||
#include <kernaux/console.h>
|
|
||||||
#include <kernaux/elf.h>
|
|
||||||
#include <kernaux/framebuffer.h>
|
|
||||||
#include <kernaux/mbr.h>
|
|
||||||
#include <kernaux/multiboot2.h>
|
|
||||||
#include <kernaux/ntoa.h>
|
|
||||||
#include <kernaux/pfa.h>
|
|
||||||
#include <kernaux/printf.h>
|
|
||||||
#include <kernaux/units.h>
|
|
||||||
|
|
||||||
#include <kernaux/arch/i386.h>
|
|
||||||
#include <kernaux/arch/riscv64.h>
|
|
||||||
#include <kernaux/arch/x86_64.h>
|
|
23
include/kernaux.h.in
Normal file
23
include/kernaux.h.in
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
We don't include <kernaux/asm/*.h> because they
|
||||||
|
contain architecture-specific assembly functions.
|
||||||
|
|
||||||
|
We don't include <kernaux/libc.h> because it may
|
||||||
|
conflict with actual freestanding or hosted libc.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <kernaux/assert.h>
|
||||||
|
@comment_line_cmdline@#include <kernaux/cmdline.h>
|
||||||
|
@comment_line_console@#include <kernaux/console.h>
|
||||||
|
@comment_line_elf@#include <kernaux/elf.h>
|
||||||
|
@comment_line_framebuffer@#include <kernaux/framebuffer.h>
|
||||||
|
@comment_line_mbr@#include <kernaux/mbr.h>
|
||||||
|
@comment_line_multiboot2@#include <kernaux/multiboot2.h>
|
||||||
|
@comment_line_ntoa@#include <kernaux/ntoa.h>
|
||||||
|
@comment_line_pfa@#include <kernaux/pfa.h>
|
||||||
|
@comment_line_printf@#include <kernaux/printf.h>
|
||||||
|
@comment_line_units@#include <kernaux/units.h>
|
||||||
|
|
||||||
|
#include <kernaux/arch/i386.h>
|
||||||
|
#include <kernaux/arch/riscv64.h>
|
||||||
|
#include <kernaux/arch/x86_64.h>
|
|
@ -10,7 +10,7 @@ extern "C" {
|
||||||
void kernaux_console_putc(char c);
|
void kernaux_console_putc(char c);
|
||||||
|
|
||||||
void kernaux_console_print(const char *s);
|
void kernaux_console_print(const char *s);
|
||||||
void kernaux_console_printf(const char *format, ...)
|
@comment_line_printf@void kernaux_console_printf(const char *format, ...)
|
||||||
__attribute__((format(printf, 1, 2)));
|
__attribute__((format(printf, 1, 2)));
|
||||||
void kernaux_console_puts(const char *s);
|
void kernaux_console_puts(const char *s);
|
||||||
void kernaux_console_write(const char *data, size_t size);
|
void kernaux_console_write(const char *data, size_t size);
|
|
@ -12,7 +12,7 @@ int atoi(const char *str)
|
||||||
while (isspace(*str)) ++str;
|
while (isspace(*str)) ++str;
|
||||||
bool is_negative = false;
|
bool is_negative = false;
|
||||||
switch (*str) {
|
switch (*str) {
|
||||||
case '-': is_negative = true;
|
case '-': is_negative = true; // fall through
|
||||||
case '+': ++str;
|
case '+': ++str;
|
||||||
}
|
}
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
Loading…
Reference in a new issue