File: build

package info (click to toggle)
oxref 2.02.00-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 692 kB
  • sloc: cpp: 1,282; makefile: 131; sh: 48
file content (157 lines) | stat: -rwxr-xr-x 4,607 bytes parent folder | download
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
#!/usr/bin/icmake -t.

#include "icmconf"

string  
    g_logPath,
    g_cwd = chdir("");  // initial working directory, ends in /

int g_echo = ON;

#include "icmake/cuteoln"
#include "icmake/backtick"

#include "icmake/setopt"
#include "icmake/run"
#include "icmake/md"
#include "icmake/special"

#include "icmake/pathfile"
#include "icmake/findall"
#include "icmake/loginstall"
#include "icmake/logrecursive"
#include "icmake/logzip"
#include "icmake/logfile"
#include "icmake/uninstall"

#include "icmake/clean"
#include "icmake/manpage"
#include "icmake/gitlab"
#include "icmake/destinstall"
#include "icmake/loginstalled"
#include "icmake/install"

void main(int argc, list argv)
{
    string option;
    string psType;          // program or strip
    int idx;
//    int precomp = 1;

    for (idx = listlen(argv); idx--; )
    {
        if (argv[idx] == "-q")
        {
            g_echo = OFF;
            argv -= (list)"-q";
        }
//        else if (argv[idx] == "-P")
//        {
//            precomp = 0;
//            argv -= (list)"-P";
//        }
        else if (strfind(argv[idx], "LOG:") == 0)
        {
            g_logPath = argv[idx];
            argv -= (list)g_logPath;
            g_logPath = substr(g_logPath, 4, strlen(g_logPath));
        }
    }

    echo(g_echo);

    option = argv[1];

    if (option == "clean")
        clean(0);

    if (option == "distclean")
        clean(1);

    if (option != "")
        special();

    if (option == "install")
        install(argv[2], argv[3]);

    if (option == "uninstall")
        uninstall(argv[2]);

    if (option == "gitlab")
        gitlab();

    if (option == "man")
        manpage();

//    if (precomp)
//        exec(P_NOCHECK, 
//            "sed -i 's,^//#define SPCH,#define SPCH,' icmconf");
//    else
//    {
//        exec(P_NOCHECK, 
//            "sed -i 's,^#define SPCH,//#define SPCH,' icmconf");
//        exec(P_NOCHECK, "rm -f *.ih.gch */*.ih.gch");
//    }
    
    if (option == "library")
    {
        system("icmbuild library");
        exit(0);
    }

    if (argv[2] == "strip") 
        psType = "strip";
    else
        psType = "program";
    
    if (option == "program")
    {
        system("icmbuild " + psType);
        exit(0);
    }

    if (option == "oxref")
    {
        system("icmbuild " + psType);
        run("oxref -t main -r replace -fxs tmp/main.o tmp/lib" LIBRARY ".a > " 
                                                        PROGRAM ".xref");
        exit(0);
    }

    printf("Usage: build [-q -P] what\n"
    "Where\n"
    "   -q:   run quietly, do not show executed commands\n"
//    "   -P:   do not use precompiled headers\n"
    "`what' is one of:\n"
    "   clean                - clean up remnants of previous compilations\n"
    "   distclean            - clean + fully remove tmp/\n"
    "   library              - build " PROGRAM "'s library\n"
    "   man                  - build the man-page (requires Yodl)\n"
    "   program [strip]      - build " PROGRAM " (optionally strip the "
                                                                "executable)\n"
    "   oxref [strip]        - same a `program', also builds xref file using "
                                                                "oxref\n"
    "   scanner [strip]      - build new scanner, then 'build program'\n"
    "   install [LOG:path] selection [base] -\n"
    "                         to install the software in the locations "
                                                            "defined \n"
    "                         in the INSTALL.im file, optionally below "
                                                            "base.\n"
    "                         LOG:path is optional: if specified `path' "
                                                            "is the\n"
    "                         logfile on which the installation log is "
                                                            "written.\n"
    "                         selection can be\n"
    "                               x, to install all components,\n"
    "                         or a combination of:\n"
    "                               b (binary program),\n"
    "                               d (documentation),\n"
    "                               m (man-pages)\n"
    "   uninstall logfile   - remove files and empty directories listed\n"
    "                         in the file 'logfile'\n"
    "   gitlab               - prepare gitlab's web-pages update\n"
    "                          (internal use only)\n"
    "\n"
    );
    exit(0);
}