diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2021-08-19 22:58:57 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2021-08-19 22:58:57 +0300 |
| commit | 1175179058fa809c57d724cd2043c67edc511695 (patch) | |
| tree | fd01aba45ff6e4c676bac5c369b8f4983163c800 /scripts/mkobjs | |
| parent | 565724db3b73ee67fa996dab511dc52df586cee1 (diff) | |
| download | kmi-1175179058fa809c57d724cd2043c67edc511695.tar.gz kmi-1175179058fa809c57d724cd2043c67edc511695.zip | |
New build system (WIP)
Diffstat (limited to 'scripts/mkobjs')
| -rwxr-xr-x | scripts/mkobjs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/scripts/mkobjs b/scripts/mkobjs new file mode 100755 index 0000000..188465b --- /dev/null +++ b/scripts/mkobjs @@ -0,0 +1,57 @@ +#!/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" |
