-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
46 lines (30 loc) · 1.6 KB
/
README
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
35
36
37
38
39
40
41
42
43
44
45
automaker-20101009
Jay Sullivan
Public Domain
This project is meant to automatically create a Makefile for C projects, provided you declare dependencies explicitly inside source files. The Makefile's contents are organized in lexical (alphabetical) order.
For example, given a source file 'test.c': to produce a Makefile that will produce 'test' along with any dependencies:
$ automaker test.c > Makefile
automaker opens 'test.c' and looks for a comment section of the following format:
/*
%use stralloc_ready;
%use stralloc_cats;
*/
The above would mean 'test' needs to be linked with 'stralloc_ready.o' and 'stralloc_cats.o', and any dependencies that come along with them (as defined in stralloc_ready.c and stralloc_cats.c). Each file (with an .o suffix) would be added to test's Makefile entry, along with any more dependencies generated after checking the file (with a .c suffix) for any of its dependencies, recursively. It then outputs a fully functioning Makefile which builds 'test'.
You may supply more than one main source file. For example:
$ automaker test1.c test2.c test3.c > Makefile
The above constructs a Makefile that creates executables 'test1', 'test2', and 'test3', linking them with all necessary dependencies.
Example :
'test' is created from 'test.c' and depends on functions from 'dep1.c', 'dep2.c', and 'dep3.c'.
Sample source code for test.c :
/*
%use dep1;
%use dep2;
%use dep3;
*/
int main()
{
dep1_func(); dep2_func(); dep3_func();
return 0;
}
To produce the Makefile to build test:
$ automaker test.c > Makefile