aboutsummaryrefslogtreecommitdiff
path: root/target.h
blob: a035e42530284a6987658d559358890ca189829c (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
#ifndef DO_TARGET_H
#define DO_TARGET_H

#include <stdlib.h>
#include <sys/stat.h>

#define TARGET_RUN_MAX_DEPTH 100
#define TARGET_SCRIPT_FILENAME_TEMPLATE "do_XXXXXX"

// Data structures
struct TargetInfo {
    size_t line_no;
    char *line;
    char *filename;
};

struct Target {
    char *id;
    char *_tmp_deps;
    char *script;
    struct TargetList *dependencies;
    struct TargetInfo info;
};


// Prototypes
struct Target *target_new();
struct Target *target_clone(const struct Target *src);
char *target_create_script_file(struct Target *t);
int target_run(struct Target *t, const size_t *depth); // single
int target_run_all(struct Target *t, size_t *depth); // recursive
void target_free(struct Target **target);

#endif //DO_TARGET_H