aboutsummaryrefslogtreecommitdiffstats
path: root/src/redo-ifchange.c
blob: cfc017b9b526e94451409b0b75f2db3db1b9cd2d (plain) (blame)
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
/* redo-ifchange.c
 *
 * Copyright (c) 2014 Tharre
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

#include <stdio.h>
#include <stdbool.h>

#include "build.h"
#include "dbg.h"

int main(int argc, char *argv[]) {
	if (!environment_sane()) {
		fprintf(stderr, "redo: environment variables are missing, \
				please use %s only in do scripts.\n", argv[0]);
		exit(1);
	}

	for (int i = 1; i < argc; ++i) {
		/*debug("Testing if %s is up-to-date ...\n", argv[i]);*/
		if (has_changed(argv[i], 'c', false)) {
			/*printf("=> no\n");*/
			build_target(argv[i]);
		} else {
			/*printf("=> yes\n");*/
		}
		add_dep(argv[i], NULL, 'c');
	}

	return 0;
}