#!/bin/sh

# Copyright (C) 2022, 2025 Tommi Höynälänmaa
# Distributed under GNU General Public License version 3,
# see file doc/GPL-3.

bootstrapdir=$(get-theme-d-config-var bootstrap-dir)
targetdir=theme-d-bootstrap

if [ -e $targetdir ] ; then
    echo "Target directory exists. Doing nothing." ;
    exit 1 ;
fi

if [ "$bootstrapdir" = "" ] ; then
    echo "Directory could not be computed. Doing nothing." ;
    exit 1 ;
fi

mkdir -p $targetdir/src/theme-d-in-theme-d
mkdir -p $targetdir/build1/theme-d-in-theme-d
mkdir -p $targetdir/bootstrap/theme-d-in-theme-d

cp $bootstrapdir/src/theme-d-in-theme-d/*.th? \
   $targetdir/src/theme-d-in-theme-d/
cp $bootstrapdir/src/theme-d-in-theme-d/bootstrap.mk \
   $targetdir/src/theme-d-in-theme-d/
cp $bootstrapdir/src/theme-d-in-theme-d/deps.mk \
   $targetdir/src/theme-d-in-theme-d/
cp $bootstrapdir/src/theme-d-in-theme-d/module-deps.mk \
   $targetdir/src/theme-d-in-theme-d/
cp $bootstrapdir/src/theme-d-in-theme-d/program-deps.mk \
   $targetdir/src/theme-d-in-theme-d/
cp $bootstrapdir/src/theme-d-in-theme-d/compute-pcode-module-deps.sh \
   $targetdir/src/theme-d-in-theme-d/
cp $bootstrapdir/src/theme-d-in-theme-d/compute-bst-program-deps.sh \
   $targetdir/src/theme-d-in-theme-d/
cp $bootstrapdir/src/theme-d-in-theme-d/compute-bst-target-module-deps.sh \
   $targetdir/src/theme-d-in-theme-d/
cp $bootstrapdir/src/theme-d-in-theme-d/compute-all-deps.sh \
   $targetdir/src/theme-d-in-theme-d/
cp $bootstrapdir/build1/theme-d-in-theme-d/user.mk \
   $targetdir/build1/theme-d-in-theme-d/
cp $bootstrapdir/bootstrap/theme-d-in-theme-d/user.mk \
   $targetdir/bootstrap/theme-d-in-theme-d/
