2021-05-29 17:45:40 +02:00
|
|
|
#!/usr/bin/icmake -t/tmp/cppannotations
|
2014-10-22 09:24:56 +02:00
|
|
|
|
2015-09-05 16:01:43 +02:00
|
|
|
#define LOGENV "CPPANNOT"
|
|
|
|
|
2018-01-18 12:35:01 +01:00
|
|
|
#include "VERSION"
|
2014-10-22 09:24:56 +02:00
|
|
|
#include "INSTALL.im"
|
2015-07-23 15:50:53 +02:00
|
|
|
#include "compilers.im"
|
2014-10-22 09:24:56 +02:00
|
|
|
|
2015-09-05 16:01:43 +02:00
|
|
|
list g_log;
|
|
|
|
string
|
|
|
|
g_logPath = getenv(LOGENV)[1],
|
|
|
|
g_logMark, // unique-marker for g_log entries
|
|
|
|
g_cwd = chdir("."); // current WD, including trailing /
|
|
|
|
|
|
|
|
int g_echo = ON;
|
|
|
|
int g_installing; // set to 1 by install.
|
|
|
|
int g_lognr; // unique-marker number counter for g_log entries
|
|
|
|
|
2014-10-22 09:24:56 +02:00
|
|
|
|
2015-09-05 16:01:43 +02:00
|
|
|
#include "icmake/cuteoln"
|
|
|
|
#include "icmake/backtick"
|
2014-10-22 09:24:56 +02:00
|
|
|
|
|
|
|
#include "icmake/run"
|
2015-09-05 16:01:43 +02:00
|
|
|
#include "icmake/mark"
|
|
|
|
#include "icmake/md"
|
|
|
|
|
|
|
|
#include "icmake/md5sum"
|
|
|
|
#include "icmake/log"
|
|
|
|
#include "icmake/logzipr"
|
|
|
|
#include "icmake/logzip"
|
|
|
|
|
|
|
|
#include "icmake/writelog"
|
|
|
|
#include "icmake/findall"
|
|
|
|
#include "icmake/loglink"
|
|
|
|
#include "icmake/loginstall"
|
|
|
|
|
2014-10-22 09:24:56 +02:00
|
|
|
#include "icmake/clean"
|
|
|
|
#include "icmake/programs"
|
|
|
|
#include "icmake/man"
|
|
|
|
#include "icmake/docs"
|
|
|
|
#include "icmake/latex"
|
|
|
|
#include "icmake/pre"
|
|
|
|
#include "icmake/install"
|
|
|
|
#include "icmake/distclean"
|
|
|
|
#include "icmake/zips"
|
|
|
|
#include "icmake/examples"
|
|
|
|
#include "icmake/verify"
|
2018-06-25 13:38:04 +02:00
|
|
|
#include "icmake/gitlab"
|
2014-10-22 09:24:56 +02:00
|
|
|
|
2015-09-05 16:01:43 +02:00
|
|
|
#include "icmake/readlog"
|
|
|
|
#include "icmake/remove"
|
|
|
|
#include "icmake/removedir"
|
|
|
|
#include "icmake/uninstall"
|
|
|
|
|
2014-10-22 09:24:56 +02:00
|
|
|
void main(int argc, list argv, list envp)
|
|
|
|
{
|
|
|
|
string option;
|
|
|
|
|
2015-09-05 16:01:43 +02:00
|
|
|
if (argv[1] == "-q")
|
|
|
|
{
|
|
|
|
g_echo = OFF;
|
|
|
|
argv -= (list)"-q";
|
|
|
|
}
|
2014-10-22 09:24:56 +02:00
|
|
|
|
2015-09-05 16:01:43 +02:00
|
|
|
echo(g_echo);
|
2014-10-22 09:24:56 +02:00
|
|
|
|
2015-09-05 16:01:43 +02:00
|
|
|
option = argv[1];
|
2014-10-22 09:24:56 +02:00
|
|
|
|
|
|
|
if (option == "clean")
|
|
|
|
clean(1);
|
|
|
|
|
|
|
|
if (option == "examples")
|
|
|
|
examples();
|
|
|
|
|
|
|
|
if (option == "programs")
|
|
|
|
{
|
|
|
|
programs(0);
|
|
|
|
programs(1);
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (option == "distclean")
|
|
|
|
distclean();
|
|
|
|
|
|
|
|
if (option == "pre")
|
|
|
|
pre();
|
|
|
|
|
2020-03-04 11:51:01 +01:00
|
|
|
putenv("FORCE_SOURCE_DATE=1"); // to ensure reproducible builds
|
|
|
|
putenv("SOURCE_DATE_EPOCH=0"); // for LaTeX documents
|
|
|
|
|
2014-10-22 09:24:56 +02:00
|
|
|
if (option == "docs")
|
|
|
|
docs();
|
|
|
|
|
2014-10-30 20:03:10 +01:00
|
|
|
if (option == "html")
|
|
|
|
runhtml();
|
|
|
|
|
2014-10-22 09:24:56 +02:00
|
|
|
if (option == "latex")
|
|
|
|
latex();
|
|
|
|
|
2014-10-30 20:03:10 +01:00
|
|
|
if (option == "ps")
|
|
|
|
runps();
|
|
|
|
|
|
|
|
if (option == "txt")
|
|
|
|
runtxt();
|
|
|
|
|
2014-10-22 09:24:56 +02:00
|
|
|
if (option == "verify")
|
|
|
|
verify();
|
|
|
|
|
|
|
|
if (option == "zips")
|
|
|
|
zips();
|
|
|
|
|
|
|
|
if (option == "man")
|
|
|
|
{
|
|
|
|
man();
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
2018-06-25 13:38:04 +02:00
|
|
|
if (option == "gitlab")
|
|
|
|
gitlab();
|
2015-08-21 16:00:17 +02:00
|
|
|
|
2015-09-05 16:01:43 +02:00
|
|
|
if (option == "uninstall")
|
|
|
|
uninstall();
|
|
|
|
|
2014-10-22 09:24:56 +02:00
|
|
|
if (option == "install")
|
2015-09-05 16:01:43 +02:00
|
|
|
install(argv[2]);
|
2014-10-22 09:24:56 +02:00
|
|
|
|
|
|
|
|
2015-09-05 16:01:43 +02:00
|
|
|
printf("Usage: build [-q] what\n"
|
|
|
|
"Where\n"
|
|
|
|
" [-q]: run quietly, do not show executed commands\n"
|
|
|
|
"`what' is one of:\n"
|
2014-10-22 09:24:56 +02:00
|
|
|
" clean - clean up remnants of previous compilations\n"
|
|
|
|
" distclean - clean remnants of locally run ./bin/ scripts\n"
|
|
|
|
"\n"
|
|
|
|
" docs - construct the C++ Annotations\n"
|
|
|
|
" Run 'build programs' and 'build pre' at least\n"
|
|
|
|
" once before 'build docs'\n"
|
|
|
|
"\n"
|
|
|
|
" examples - compile all examples\n"
|
2015-09-05 16:01:43 +02:00
|
|
|
" install [base] - install the C++ Annotations in the locations\n"
|
2014-10-22 09:24:56 +02:00
|
|
|
" defined in the INSTALL.im file, optionally\n"
|
2015-09-05 16:01:43 +02:00
|
|
|
" below 'base'\n"
|
2014-10-30 20:03:10 +01:00
|
|
|
" html - force the html construction\n"
|
|
|
|
" latex - force the latex construction, (cf 'verify')\n"
|
2014-10-22 09:24:56 +02:00
|
|
|
" man - build the manual page (requires Yodl)\n"
|
|
|
|
" pre - prepare files for independent `docs' call\n"
|
2014-10-30 20:03:10 +01:00
|
|
|
" ps - create .ps/.pdf files afer 'build latex'\n"
|
2014-10-22 09:24:56 +02:00
|
|
|
" programs - build support programs\n"
|
2014-10-30 20:03:10 +01:00
|
|
|
" txt - force the txt construction\n"
|
2014-10-22 09:24:56 +02:00
|
|
|
" verify - run after `build docs' to find overfull boxes\n"
|
|
|
|
" or undefined references in\n"
|
|
|
|
" tmp/docs/latex/cplusplus.log\n"
|
|
|
|
" zips - zip archives (after doc)\n"
|
2015-09-05 16:01:43 +02:00
|
|
|
" uninstall - remove installed files and empty directories\n"
|
2018-06-25 13:38:04 +02:00
|
|
|
" gitlab - prepare gitlab's gh-pages update\n"
|
2015-08-21 16:00:17 +02:00
|
|
|
" (internal use only)\n"
|
2014-10-22 09:24:56 +02:00
|
|
|
"\n"
|
|
|
|
);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
2009-11-05 21:16:31 +01:00
|
|
|
|