summaryrefslogtreecommitdiff
path: root/notes/makefile.txt
blob: a8387fc7e4864985dec18dfc5592d4e92e633885 (plain)
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
46
47


Safe commands (according to pmake man page):

    = += ?= !=
    .PHONY .PRECIOUS .SUFFIXES
    :old=new
    $@ $<

    do ! (always re-create) :: (complex behavoir) rules work?
    do shell wildcards in rules work?
    are .depend files read?
    - looks like no. GNU Make tries to read some (version control?) files named RCS and SCCS
    - but GNU Make also lists the files in the current directory, so it is hard to tell what it looks for


dependency resolution:

1) run a command from the make file (will probably need one command per target)
    lrl_depend != $(LRLC) --depends xxxx

2) run a command to generate the Makefile (like ./configure)
  - ./configure could contain #!/usr/bin/env lrlc --configure
  - and then available configuration options etc. could follow
  - and/or it could read from the module.cfg file (and perhaps "build.cfg")

3) define local includes in the Makefile, and have lrlc read the Makefile
  - for large projects, this will cause lots of changes to the Makefile,
    which will cause merge conflicts.
  - code review becomes harder (information is spread over multiple places)
  -- but also easier in one way (one can check module dependencies easiliy)


probably, 2 is the best solution.
and when more powerfull makefiles are needed, one could have an option
like "lrlc --mkdep" to say that it should only generate dependencies.


for large projects with nested modules:
- there will be a project-global settings file
- from this file we can generate makefiles for nested/bundled modules
1. Main configure script outputs a "user_options.cfg" file
2. Main Makefile contains lines like this:
    nested_module1/Makefile nested_module2/Makefile: build.cfg user_options.cfg dependencies.stamp
        $(LRLC) --configure --options=user_options.cfg --base=build.cfg --target=$@
    invalidate-makefiles:
        touch dependencies.stamp
-- NOTE: The code above will not automatically regenerate Makefile when the dependency tree changes due to source changes