1 // Copyright (C) 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /* Copyright (C) 2011 IBM Corporation and Others. All Rights Reserved */
7 -o makeconv makeconv.o ucnvstat.o ../../lib/libicuuc48.so -qOPTION='*DUPPROC *DUPVAR*'
9 CRTPGM PGM(SRLICU/MAKECONV) MODULE(SRLICU/MAKECONV SRLICU/UCNVSTAT SRLICU/GENMBCS SRLICU/GENCNVEX) BNDSRVPGM(SRLICU/LIBICUUC48 SRLICU/LIBICUTU48 SRLICU/LIBICUIN48) OPTION(*DUPPROC *DUPVAR) REPLACE(*YES)
11 Handles .o ( modules ), .so ( srvpgm ), .a ( bnddir ).
16 - much better error handling
18 - instead of caring about .o vs .so vs .a, just read the link - if it ends in .srvpgm then treat it as a service program, etc.
35 static int Qp0zSystem(const char *cmd) {
36 printf("CL: %s\n", cmd);
41 static int runcmd(const char *cmd) {
49 printf("..Qp0zSystem failed.\n");
52 printf("..System call failed.\n");
57 int main(int argc, const char *argv[]) {
66 const char *progshort=prog;
67 const char *outputdir=getenv("OUTPUTDIR");
69 printf("# OUTPUTDIR=%s ",outputdir);
71 printf("%s ", argv[i]);
85 printf(".. ignoring optimization: %s\n", argv[i]);
88 printf(".. ignoring debugging: %s\n", argv[i]);
91 printf(".. ignoring lib: %s\n", argv[i]);
94 printf(".. already verbose\n");
99 progshort=strrchr(prog,'/');
107 if(!strncmp(argv[i]+2,"OPTION=",7)) {
108 strcat(opt,argv[i]+9);
110 printf("Unknown -q option: %s\n", argv[i]);
115 printf("Unknown option: %s\n", argv[i]);
119 int n = strlen(argv[i]);
120 if(argv[i][n-1]=='o' &&
122 const char *b = argv[i];
131 if(readlink(b,linkbuf,200)>0) {
132 /* printf("linkbuf %s for %s\n", linkbuf, b); */
133 /* /qsys.lib/srlicu.lib/currtest.module */
134 char *mend = strrchr(linkbuf,'.');
137 mend = strrchr(linkbuf,'/');
146 /* perror("readlink");
150 strcat(objs,outputdir);
152 strncat(objs,b,nlen);
154 } else if(argv[i][n-1]=='a' &&
156 const char *b = argv[i];
165 if(readlink(b,linkbuf,200)>0) {
166 /* printf("linkbuf %s for %s\n", linkbuf, b); */
167 /* /qsys.lib/srlicu.lib/currtest.srvpgm */
168 char *mend = strrchr(linkbuf,'.');
171 mend = strrchr(linkbuf,'/');
180 /* perror("readlink");
184 strcat(bnddirs,outputdir);
186 strncat(bnddirs,b,nlen);
187 strcat(bnddirs, " ");
188 } else if(argv[i][n-1]=='o' &&
191 const char *p = strrchr(argv[i],'/');
193 printf("Can't find trailing slash in %s\n", argv[i]);
196 strcat(libs,outputdir);
198 strncat(libs,p+1,strlen(p)-4);
201 printf("Unknown input file: %s\n", argv[i]);
208 printf("no program (-o) option specified.\n");
212 sprintf(buf,"CRTPGM PGM(%s/%s) MODULE(%s) BNDSRVPGM(%s) BNDDIR(%s) OPTION(%s) REPLACE(*YES)",
231 sprintf(path1,"/qsys.lib/%s.lib/%s.pgm",
234 printf("# ln -s %s %s\n", path1, prog);
235 if((!TEST_MODE) && symlink(path1,prog)) {
237 if(errno!=EEXIST) { /* ignored */