Fix formatting
[tmk.git] / tm_target.h
blob8d2f010c795a54edb0aa577f48a1c753642d9b70
1 #ifndef TM_TARGET_H
2 #define TM_TARGET_H
4 #include "tmake.h"
6 #define TM_EXPLICIT 0
7 #define TM_IMPLICIT 1
8 #define TM_FILENAME 2
9 #define TM_UPDATED 3
11 #define TM_UNMARKED 0
12 #define TM_TEMPORARY 1
13 #define TM_PERMANENT 2
15 struct target_list;
17 typedef struct tm_rule {
18 char *target;
19 struct target_list *deps;
20 char *recipe;
21 unsigned char type;
22 unsigned char mark;
23 unsigned char always_oodate;
24 } tm_rule;
26 typedef struct target_list {
27 char *name;
28 struct target_list *next;
29 } target_list;
31 typedef struct tm_rule_list {
32 struct tm_rule *rule;
33 struct tm_rule_list *next;
34 } tm_rule_list;
36 tm_rule *new_rule(const char *target, target_list *deps, const char *recipe);
37 tm_rule *new_filename(const char *target);
39 target_list *target_cons(const char *name, target_list *next);
40 tm_rule_list *rule_cons(tm_rule *rule, tm_rule_list *next);
42 target_list *target_list_copy(target_list *targets);
44 int target_exists(const char *target, target_list *targets);
45 tm_rule *find_rule(const char *name, tm_rule_list *rules);
46 tm_rule_list *find_rules(target_list *targets, tm_rule_list *rules);
47 void find_files(tm_rule_list **rules);
49 tm_rule_list *topsort(const char *target, tm_rule_list *rules);
51 tm_rule_list *rule_list_reverse(tm_rule_list *rules);
52 target_list *target_list_reverse(target_list *targets);
54 void free_rule(tm_rule *rule);
55 void free_target_list(target_list *targets);
56 void free_rule_list(tm_rule_list *rules);
58 char *target_list_to_string(target_list *targets);
59 void print_rule_list(tm_rule_list *rules);
61 extern char *tm_goal;
62 extern tm_rule_list *tm_rules;
64 #endif