1 /* MetaMake - A Make extension
2 Copyright © 1995-2004, The AROS Development Team. All rights reserved.
4 This file is part of MetaMake.
6 MetaMake is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
11 MetaMake is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU CC; see the file COPYING. If not, write to
18 the Free Software Foundation, 59 Temple Place - Suite 330,
19 Boston, MA 02111-1307, USA. */
27 #endif /* PROTOTYPES */
29 #if defined(HAVE_STDARG_H) && defined(__STDC__) && __STDC__
31 # define VA_START(args, lastarg) va_start(args, lastarg)
34 # define VA_START(args, lastarg) va_start(args)
38 # define __DATE__ "No __DATE__"
52 #ifdef HAVE_SYS_STAT_H
53 # include <sys/stat.h>
55 #ifdef HAVE_SYS_TYPES_H
56 # include <sys/types.h>
73 error (char * fmt
, ...)
77 fprintf (stderr
, "Error: ");
78 vfprintf (stderr
, fmt
, args
);
80 fprintf (stderr
, ": %s", strerror (errno
));
81 fprintf (stderr
, "\n");
87 main (int argc
, char ** argv
)
94 currdir
= getcwd (NULL
, 1024);
98 for (t
=1; t
<argc
; t
++)
100 if (argv
[t
][0] == '-')
102 if (!strcmp (argv
[t
], "--version"))
104 printf ("MetaMake %s (%s)\n", PACKAGE_VERSION
, __DATE__
);
108 else if (!strcmp (argv
[t
], "--verbose") || !strcmp (argv
[t
], "-v"))
112 else if (!strcmp (argv
[t
], "--debug"))
116 else if (!strcmp (argv
[t
], "--help"))
118 printf ("%s [--version] [-v,--verbose] [--debug] [--help]\n", argv
[0]);
123 mflags
[mflagc
++] = argv
[t
];
128 targets
[targetc
++] = argv
[t
];
136 Project
* firstprj
= getfirstproject ();
140 targets
[targetc
++] = firstprj
->node
.name
;
143 for (t
=0; t
<targetc
; t
++)
145 char * pname
, * tname
, * ptr
;
148 pname
= ptr
= targets
[t
];
149 while (*ptr
&& *ptr
!= '.')
155 prj
= findproject (pname
);
159 printf ("Nothing known about project %s\n", pname
);
163 maketarget (prj
, tname
);