aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2021-08-20 20:57:59 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2021-08-20 21:04:24 +0300
commit31c3c8dcb5ea281201b9c01140bceeadc80f7686 (patch)
tree5424805f919938e58e0a2c88c0e3d8f583fbcfd7 /scripts
parent1175179058fa809c57d724cd2043c67edc511695 (diff)
downloadkmi-31c3c8dcb5ea281201b9c01140bceeadc80f7686.tar.gz
kmi-31c3c8dcb5ea281201b9c01140bceeadc80f7686.zip
New build system
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/gen-deps43
-rwxr-xr-xscripts/mkobjs57
-rwxr-xr-xscripts/prepend11
3 files changed, 43 insertions, 68 deletions
diff --git a/scripts/gen-deps b/scripts/gen-deps
new file mode 100755
index 0000000..b764deb
--- /dev/null
+++ b/scripts/gen-deps
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+gencommon () {
+ dep="build/${s%.*}${1}.d"
+ obj="build/${s%.*}${1}"
+
+ mkdir -p $(dirname ${dep})
+
+ echo "${dep}:" >> deps.mk
+ echo "include ${dep}" >> deps.mk
+ echo "${obj}: ${s}" >> deps.mk
+
+}
+genlink () {
+ gencommon ".ld"
+ echo " \$(GENLINK) $< | \$(STRIPLINK) > \$@" >> deps.mk
+}
+
+genrule () {
+ gencommon "${1}"
+ echo " \$(COMPILE) -c \$< -o \$@" >> deps.mk
+}
+
+case "${1}" in
+ --kern)
+ suffix=.k.o
+ func=genrule
+ ;;
+ --init)
+ suffix=.i.o
+ func=genrule
+ ;;
+ --link)
+ suffix=.ld
+ func=genlink
+ ;;
+esac
+
+for s in ${2}
+do
+ ${func} ${suffix}
+ echo ${obj}
+done
diff --git a/scripts/mkobjs b/scripts/mkobjs
deleted file mode 100755
index 188465b..0000000
--- a/scripts/mkobjs
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/sh
-
-genobj () {
- path=$(dirname "$1")/
- obj=$(echo "$1" | sed "s/\\.[cS]/.${command_suffix}.o/")
- $cc_command -MM -MP $n | \
- sed "s|\\(.*\)\\.o|${path}\\1.${command_suffix}.o|" >> deps.mk
-
- echo "$obj: $n" >> deps.mk
- echo " $cc_command -c $1 -o $obj" >> deps.mk
-
- cc_objs="$cc_objs $obj"
-}
-
-genlink () {
- link=$(echo "$1" | sed 's/\.S/.ld/')
- echo "$link: $1" >> deps.mk
- echo " $cc_command $1 | sed -n '/^[^#]/p' > $link" >> deps.mk
-
- cc_objs="$cc_objs $link"
-}
-
-for n in "$@"
-do
- case "$n" in
- --kern-files)
- command_suffix=k
- command_func=genobj
- continue
- ;;
-
- --kern-lds)
- command_func=genlink
- continue
- ;;
-
- --init-files)
- command_suffix=i
- command_func=genobj
- continue
- ;;
-
- --init-lds)
- command_func=genlink
- continue
- ;;
- esac
-
- if [ "$command_func" = "" ]
- then
- cc_command="$cc_command $n"
- else
- $command_func "$n"
- fi
-done
-
-echo "$cc_objs"
diff --git a/scripts/prepend b/scripts/prepend
deleted file mode 100755
index ef10da1..0000000
--- a/scripts/prepend
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-prep="$1"
-shift
-
-for n in "$@"
-do
- ret="$ret $prep$n"
-done
-
-echo "$ret"