1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
#!/usr/bin/icmake -t.
#include "VERSION"
#include "INSTALL.im"
// Use the next one to see what parser/p_parse() does
//#define COPT "-O2 -Wall -DEBUG"
#define COPT "-O2 -Wall -fdiagnostics-color=never "
// -Werror"
#define STD_CONVERSIONS "html latex man txt xml"
#define ECHO_REQUEST 1
// uncomment to show the full gcc commands when compiling
// #define ECHO_COMPILE
string CLASSES;
string g_lopt;
string g_copt;
string g_cwd;
string g_wip = "tmp/wip"; // no slash here
string g_install = "tmp/install"; // no slash here
int g_compiled;
int g_nClasses;
list g_classes;
#include "icmake/run"
#include "icmake/md"
#include "icmake/clean"
#include "icmake/stdcpp"
#include "icmake/stdcompile"
#include "icmake/compilerss"
#include "icmake/builtins"
#include "icmake/program"
#include "icmake/buildmacros"
#include "icmake/manualmacrolist"
#include "icmake/macros"
#include "icmake/man"
#include "icmake/manual"
#include "icmake/install"
#include "icmake/gitlab"
string setOpt(string install_im, string envvar)
{
list optvar;
string ret;
optvar = getenv(envvar);
if (optvar[0] == "1")
ret = optvar[1];
else
ret = install_im;
return ret;
}
void main(int argc, list argv)
{
string arg1;
echo(ECHO_REQUEST);
g_cwd = chdir(".");
g_copt = setOpt(COPT + " -g", "CFLAGS");
#ifdef PROFILING
g_copt = COPT + " -pg";
g_lopt = "-pg";
#endif
g_lopt = setOpt(g_lopt, "LDFLAGS");
#ifdef EXTENSIVE_OPTIONS
g_copt = "-O0 -g3 -ansi -pedantic -fno-common -pipe -W -Wall -Wcast-align"
" -Wcast-qual -Wconversion -Wformat=2 -Winline -Wnested-externs"
" -Wpointer-arith -Wshadow -Wstrict-prototypes -Wundef "
"-Wno-unused-parameter -Waggregate-return -Wnested-externs";
#endif
setLocations();
if (
STD_INCLUDE[0] != "/" || BIN[0] != "/" || MAN[0] != "/" ||
DOC[0] != "/" || DOCDOC[0] != "/" )
{
printf("Check INSTALL.im: BIN, DOC, DOCDOC, MAN, STD_INCLUDE, "
"must be absolute paths\n");
exit(1);
}
arg1 = argv[1];
if (arg1 == "clean" || arg1 == "distclean")
cleanupExit();
md(g_install + " " + g_wip);
// g_include = " -I.:" + g_install + STD_INCLUDE + ":" + g_wip;
echo(OFF);
run("rm -f " + g_wip + "/release.yo " + g_wip + "/config.h");
echo(ON);
fprintf(g_wip + "/release.yo", "SUBST(_CurVers_)(", VERSION, ")\n",
"SUBST(_CurYrs_)(", YEARS, ")\n",
"manttquoted(1)\n");
fprintf(g_wip + "/config.h",
"#define STD_INCLUDE \"", STD_INCLUDE, "\"\n"
"#define VERSION \"" VERSION "\"\n"
"#define YEARS \"" YEARS "\"\n"
"#define YODL_BIN \"", BIN, "\"\n"
);
if (arg1 == "programs")
programsExit(argv[2]); // icmake/program
if
(
arg1 == "yodl" || arg1 == "yodlpost" || arg1 == "yodlverbinsert" ||
arg1 == "yodlstriproff" || arg1 == "yodl2whatever" || arg1 == "programs"
)
programExit(arg1, argv[2]);
// requires 'build programs'
if (arg1 == "macros") // run before 'build man', etc.
macrosExit();
if (arg1 == "man")
manExit(argv[2]);
if (arg1 == "manual")
manualExit("", argv[2]);
if (arg1 == "html")
manualExit("html", argv[2]);
if (arg1 == "latex")
manualExit("latex", argv[2]);
// Debian package construction
// .gz compresses the man-pages
// defines .gz links to
// man1/yodlconverters.1.gz
if (arg1 == "install")
installExit(argv[2], argv[3]); // icmake/install
if (arg1 == "gitlab")
gitlab();
printf("Usage: build action\n"
"Where `action' is one of:\n"
" (dist)clean: clean up\n"
" programs [strip]: build the programs\n"
" yodl [strip]: only build `yodl'\n"
" yodlpost [strip]: only build `yodlpost'\n"
" yodlverbinsert [strip]: only build `yodlverbinsert'\n"
" yodlstriproff: only build `yodlstriproff\n"
" yodl2whatever: only build `yodl2whatever\n"
" macros: (re)build the standard yodl macros\n"
" run `build programs' first, run `build macros'\n"
" before any of the following document-creating "
" commands\n"
" man [path]: (re)build the man-pages, optionally specify: "
"path\n"
" manual [path]: (re)build the manual, optionally specify: path\n"
" html [path]: (re)build the html version of the manual\n"
" (after 'manual' or 'macros')\n"
" latex [path]: (re)build the latex version of the manual\n"
" (after 'manual' or 'macros')\n"
" install programs WHERE: install the programs under WHERE\n"
" install yodl WHERE: install yodl under WHERE\n"
" install yodlpost WHERE: install yodlpost under WHERE\n"
" install yodlverbinsert WHERE: install yodlverbinsert under WHERE\n"
" install yodlstriproff WHERE: install yodlstriproff under WHERE\n"
" install yodl2whatever WHERE: install yodl2whatever c.s. under "
"WHERE\n"
" install macros WHERE: install the macros under WHERE\n"
" install man WHERE: install the man-pages under WHERE\n"
" install mandeb WHERE: install the man-pages for Debian\n"
" under WHERE\n"
" install manual WHERE: install the manual under WHERE\n"
" install docs WHERE: install additional docs under "
"WHERE\n"
" gitlab - prepare gitlab's web-pages update\n"
" (internal use only)\n"
"`strip': the program(s) will be stripped,\n"
"`path': yodl is located in $PATH (otherwise just-built programs "
"are used).\n"
);
exit(0);
}
|