-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·32 lines (25 loc) · 1.6 KB
/
Copy pathconfigure
File metadata and controls
executable file
·32 lines (25 loc) · 1.6 KB
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
#!/bin/sh
# This script creates a 'GNUmakefile' with almost the same functionality as the present 'Makefile'
# There are three differences:
# - Variables passed from the command-line don't affect make anymore (like DEBUG= or SPEED=),
# which means you have to choose the flags/options you need when calling this script
# - Dependency makefiles (.d-files) are already included and expanded in GNUmakefile.
# -> When a dependency of any source-file changes, the dependencies inside the GNUmakefile will be outdated and it should be generated again!
# - The generated GNUmakefile is completely expanded and thus executes much much faster than Makefile
# For the reasons given above, this configure-script is suitable for development of single .c-files, after all dependencies have
# been established!
# Let make dump it's internal database with the passed parameters.
# This creates a big GNUmakefile (which is used by make prior to Makefile), filled with all targets and variables,
# already expanded. This GNUmakefile is executable by make and greatly speeds up the make-process!
# Dry-execute make once, to create all depended-on sub-Makefiles (.d).
# make reexecutes itself after that, which causes a double data-base being printed to GNUmakefile.
make -q -f Makefile $@ > /dev/null
make -q -f Makefile -p $@ > GNUmakefile
# Remove lines starting with '!'. Also, remove the MAKEFLAGS used to create this database dump.
sed -i GNUmakefile \
-e 's|^!.*$||' \
-e 's|^MAKEFLAGS.*$|MAKEFLAGS \= \-\- \$\(MAKEOVERRIDES\)|' \
header="# This Makefile was created with the following options:
# $@
"
echo "$header" >> GNUmakefile