aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxSlendiX <slendi@socopon.com>2022-12-24 20:04:59 +0200
committerxSlendiX <slendi@socopon.com>2022-12-24 20:04:59 +0200
commit1946864ab3a7e0d88dec6253d1848e7475558d18 (patch)
treef829747dfae6ec6146780fbb9b6db3d92fc14623
parent6b995e15829801e91b6deb13b4fa026dcffd5fe6 (diff)
Add documentation.
Signed-off-by: xSlendiX <slendi@socopon.com>
-rw-r--r--main.c6
-rw-r--r--man/tbuild-build.158
-rw-r--r--man/tbuild-clean.114
-rw-r--r--man/tbuild-init.126
-rw-r--r--man/tbuild-manifest.551
-rw-r--r--man/tbuild.132
6 files changed, 184 insertions, 3 deletions
diff --git a/main.c b/main.c
index 29ad59b..7682b52 100644
--- a/main.c
+++ b/main.c
@@ -410,9 +410,9 @@ void print_help(char **argv) {
printf("Usage: %s [command]\n", argv[0]);
fputs("\nCommands:\n", stderr);
fputs(" * init|i [path=.] - Setup a new project.\n", stderr);
- fputs(" * build|. [--zeal|-z|-Z] [--watch|-w|-W] - Build project in current working directory.\n", stderr);
- fputs(" * clean - Clean output code in current working directory.\n", stderr);
- fputs("\nTo read more about the manifest file, check out tbuild_manifest(1).\n", stderr);
+ fputs(" * build|b|. [--zeal|-z|-Z] [--watch|-w|-W] - Build project in current working directory.\n", stderr);
+ fputs(" * clean|c - Clean output code in current working directory.\n", stderr);
+ fputs("\nTo read more about the manifest file, check out tbuild-manifest(5).\n", stderr);
}
bool file_exists(char const *path) {
diff --git a/man/tbuild-build.1 b/man/tbuild-build.1
new file mode 100644
index 0000000..765b084
--- /dev/null
+++ b/man/tbuild-build.1
@@ -0,0 +1,58 @@
+.TH "TBUILD-BUILD" "1" "" "" "TBuild Manual"
+.nh
+.ad l
+.SH "NAME"
+tbuild-build \- Build a project. Aliases: [b|.]
+.SH "SYNOPSIS"
+.SP
+.nf
+\fItbuild build\fR [-z|-Z|--zeal] [-w|-W|--watch]
+.fi
+.SP
+.SH DESCRIPTION
+.sp
+This command build a project based on your current working directory. If a manifest is not found in your current working directory, tbuild will then start to look in parent directories.
+.sp
+When run the following steps will be taken when the command is executed:
+.if n \{\
+.RE
+.\}
+.sp
+\fB1. \fRAll dependencies get updated\&.
+.br
+\fB2. \fRThe build directory is created and files are copied (lib/ and src/)\&.
+.br
+\fB3. \fRScripts are run if a scripts/ directory is present\&.
+.br
+\fB4. \fRZealOS conversion starts if enabled\&.
+.br
+\fB5. \fRAll of the above get repeated if in \fIwatch mode\fR\&.
+.br
+.SH OPTIONS
+.PP
+\-z, \-Z. \-\-zeal
+.RS 4
+After code is generated and built, the built code will then be converted to be ZealOS-compatible. For now, it only does a simple find and replace.
+.RE
+.PP
+\-w, \-W. \-\-watch
+.RS 4
+\fItbuild\fR will enter \fIwatch mode\fR, in which it continues to check for file changes under the src/ and lib/ directories. Whenever a change is detected, the code is the re-built.
+.RE
+.SH SCRIPTS
+.sp
+Scripts are a great feature of tbuild. They enable features like code generation. In order to use it, you need to have a folder called "scripts" inside your root project directory. In it, you can then place various \fBpython\fR(1) scripts to run. Those files are ran in the order provided by your operating system. This feature also supports recursion, which allows you to have a tree-structure of scripts.
+.sp
+An important thing to keep in mind is that python scripts are ran \fBin the current directory\fR you are in. In order to mitigate that, you may want to use something like this:
+.RS 4
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+import os
+project_path = os.path.dirname(os.path.realpath(__file__)) + '/..'
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/tbuild-clean.1 b/man/tbuild-clean.1
new file mode 100644
index 0000000..4394628
--- /dev/null
+++ b/man/tbuild-clean.1
@@ -0,0 +1,14 @@
+.TH "TBUILD-CLEAN" "1" "" "" "TBuild Manual"
+.nh
+.ad l
+.SH "NAME"
+tbuild-clean \- Safely clean a project. Aliases: [c]
+.SH "SYNOPSIS"
+.SP
+.nf
+\fItbuild clean\fR
+.fi
+.SP
+.SH DESCRIPTION
+.sp
+This commands allows you to easily and conveniently clean the build files such as the out/ and build/ directories.
diff --git a/man/tbuild-init.1 b/man/tbuild-init.1
new file mode 100644
index 0000000..540b478
--- /dev/null
+++ b/man/tbuild-init.1
@@ -0,0 +1,26 @@
+.TH "TBUILD-INIT" "1" "" "" "TBuild Manual"
+.nh
+.ad l
+.SH "NAME"
+tbuild-init \- Initialize a new project. Aliases: [i]
+.SH "SYNOPSIS"
+.SP
+.nf
+\fItbuild init\fR [project_path]
+.fi
+.SP
+.SH DESCRIPTION
+.sp
+This commands allows you to create the basic boilerplate of a tbuild project without requiring you do write files like the manifest file manually. If provided with a \fBproject_path\fR, tbuild will initialize a new project in that directory.
+.sp
+When run the following steps will be taken:
+.if n \{\
+.RE
+.\}
+.sp
+\fB1. \fRCreate the build directory, if it doesn't exist already\&.
+.br
+\fB2. \fRCreate the manifest file\&.
+.br
+\fB3. \fRCreate a basic hello world project\&.
+.br
diff --git a/man/tbuild-manifest.5 b/man/tbuild-manifest.5
new file mode 100644
index 0000000..a640cab
--- /dev/null
+++ b/man/tbuild-manifest.5
@@ -0,0 +1,51 @@
+.TH "TBUILD MANIFEST" 5 "" "" "TBuild Manual"
+.SH NAME
+tos_project.toml \- TBuild project manifest file
+.SH DESCRIPTION
+The file
+.I tos_project.toml
+contains configuration infromation about a tbuild project. It is based off of
+the TOML file format, which is similar to that of an INI file.
+The following sections are recognized:
+.TP
+.I General
+This section contains general information about the project.
+.TP
+.I Dependencies
+This section contains different dependencies of the project.
+.SH GENERAL
+The General section contains a few variables which can be changed:
+.TP
+.I Name [string]
+The name of the project.
+.TP
+.I Author [string]
+Who made the project.
+.TP
+.I Version [string]
+The version of the project.
+.SH DEPENDENCIES
+The General section is a bit more complicated. It is made of key-value pairs,
+the key being the name of the dependency and the value being the git repository
+to it.
+.SH EXAMPLE
+.PP
+This is how a simple configuration file may look like, using Alec's AC97 driver
+library:
+.RS 4
+.sp
+.if n \{\
+.RS 4
+.\}
+.nf
+[General]
+Name="MyProject"
+Author="Jeff"
+Version="2.2"
+
+[Dependencies]
+ac97 = "https://git.checksum.fail/slendi/ac97.git"
+.fi
+.if n \{\
+.RE
+.\}
diff --git a/man/tbuild.1 b/man/tbuild.1
new file mode 100644
index 0000000..aacc84e
--- /dev/null
+++ b/man/tbuild.1
@@ -0,0 +1,32 @@
+.TH "TBUILD" "1" "" "" "TBuild Manual"
+.nh
+.ad l
+.SH "NAME"
+tbuild \- build system for TempleOS.
+.SH "SYNOPSIS"
+.SP
+.nf
+\fItbuild\fR <command> [<args>]
+.fi
+.SP
+.SH DESCRIPTION
+.sp
+TBuild is a BLAZINGLY FAST, scalable and simple build system for TempleOS. It
+features various features such as dependency mangement with git and ISO.C
+generation.
+.SH "TBUILD COMMANDS"
+.PP
+\fBtbuild-init\R(1)
+.RS 4
+Initialize a new project.\&
+.RE
+.PP
+\fBtbuild-build\fR(1)
+.RS 4
+Build a project.\&
+.RE
+.PP
+\fBtbuild-clean\fR(1)
+.RS 4
+Safely clean a project.\&
+.RE