aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Moffett <ian@osmora.org>2024-04-24 23:38:14 -0400
committerIan Moffett <ian@osmora.org>2024-04-24 23:51:12 -0400
commit3c50e6cf145ef8e9d661a80d40e85bceefca7dfa (patch)
tree9bd297dd65ab5f48282d852cb24cdd1e7c99c66c
parent39cc8bb40aa5c3c592354e34b8298eaac8ef63ff (diff)
build: Export some sys/*.h headers
Signed-off-by: Ian Moffett <ian@osmora.org>
-rw-r--r--Makefile.in1
-rw-r--r--builddeps/sysexports10
-rw-r--r--lib/libc/.gitignore2
-rw-r--r--lib/libc/Makefile2
-rwxr-xr-xtools/sysexport32
5 files changed, 47 insertions, 0 deletions
diff --git a/Makefile.in b/Makefile.in
index eb53811..331554d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -92,6 +92,7 @@ base:
.PHONY: lib
lib:
+ bash tools/sysexport
cd lib/; make $(USER_MKFLGS)
cp lib/libc/build/libc.a base/usr/lib/
diff --git a/builddeps/sysexports b/builddeps/sysexports
new file mode 100644
index 0000000..4c0f0e1
--- /dev/null
+++ b/builddeps/sysexports
@@ -0,0 +1,10 @@
+# Sys header export list
+# Add headers to be exported to userland here
+# Example: foo.h corresponds to sys/include/sys/foo.h
+sys_headers=$(cat <<END
+ fbdev.h
+ errno.h
+ queue.h
+ signal.h
+END
+)
diff --git a/lib/libc/.gitignore b/lib/libc/.gitignore
index 567609b..87705f8 100644
--- a/lib/libc/.gitignore
+++ b/lib/libc/.gitignore
@@ -1 +1,3 @@
build/
+include/sys/.gitignore
+include/sys/.sys_export
diff --git a/lib/libc/Makefile b/lib/libc/Makefile
index 927c177..6eeb9f3 100644
--- a/lib/libc/Makefile
+++ b/lib/libc/Makefile
@@ -31,3 +31,5 @@ build/:
clean:
rm -f $(LIBC_OBJ) $(LIBC_ASMOBJ)
rm -rf build/
+ rm -f $(shell cat include/sys/.sys_export)
+ rm include/sys/.sys_export include/sys/.gitignore
diff --git a/tools/sysexport b/tools/sysexport
new file mode 100755
index 0000000..8426e8d
--- /dev/null
+++ b/tools/sysexport
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# To be ran during the build process to export
+# system headers
+#
+
+TARGET_DIR=lib/libc/include/sys
+SYS_DIR=../../../../sys/include/sys
+
+if [ -f $TARGET_DIR/.sys_export ]
+then
+ exit 0
+fi
+
+. builddeps/sysexports
+
+echo "Exporting sys headers..."
+cd $TARGET_DIR
+
+for i in $sys_headers
+do
+ if [ -s "$i" ]
+ then
+ echo "HEADER CONFLICT ($TARGET_DIR/$i)"
+ continue
+ fi
+
+ echo "sys/include/sys/$i -> lib/libc/include/sys/$i"
+ echo include/sys/$i >>.sys_export
+ echo "$i" >>.gitignore
+ ln -sf $SYS_DIR/$i .
+done