summaryrefslogtreecommitdiffstats
path: root/modules.sh
blob: 672ea97150e7fbdf99d61398069e07a13238cd88 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/sh
#
# BEGIN COPYRIGHT BLOCK
# Copyright 2001 Sun Microsystems, Inc.
# Portions copyright 1999, 2001-2003 Netscape Communications Corporation.
# All rights reserved.
# END COPYRIGHT BLOCK
#
#
# This is extracted from the 2.0 config shell script to decouple the module
# extraction functionality.
#
# Input:  modules.awk
# Output: modules.mk  (this will be included in nsconfig.mk)
#

awk '
/^LIBRARY.*/ { 
        printf "%s:", $2
        for (i = 4; i <= NF; i++) printf " %s", $i
        printf "\n\tcd %s; $(MAKE) $(MFLAGS)\n", $3
        printf "clean_%s:", $2
        for (i = 4; i <= NF; i++) printf " clean_%s", $i
        printf "\n\tcd %s; $(MAKE) clean\n\n", $3
        printf "depend_%s:", $2
        for (i = 4; i <= NF; i++) printf " depend_%s", $i
        printf "\n\tcd %s; $(MAKE) depend\n\n", $3
        printf("else\nclean:");
        for (i = 4; i <= NF; i++) printf " clean_%s", $i
        printf("\ndepend:");
        for (i = 4; i <= NF; i++) printf " depend_%s", $i
        printf("\n");
        next 
} 
/^DISTLIB.*/ { 
        printf "%s:", $2
        for (i = 4; i <= NF; i++) printf " %s", $i
        printf "\n\tcd %s; $(MAKE) export $(NSDEFS)\n", $3
        printf "clean_%s:", $2
        for (i = 4; i <= NF; i++) printf " clean_%s", $i
        printf "\n\tcd %s; $(MAKE) clean\n\n", $3
        printf "depend_%s:", $2
        for (i = 4; i <= NF; i++) printf " depend_%s", $i
        printf "\n\tcd %s; $(MAKE) depend\n\n", $3
        printf("else\nclean:");
        for (i = 4; i <= NF; i++) printf " clean_%s", $i
        printf("\ndepend:");
        for (i = 4; i <= NF; i++) printf " depend_%s", $i
        printf("\n");
        next 
} 
/^MODULE.*/ { 
        printf "%s:", $2
        for (i = 4; i <= NF; i++) printf " %s", $i
        printf "\n\tcd %s; $(MAKE) $(MFLAGS)\n\n", $3
        printf "clean_%s:", $2
        for (i = 4; i <= NF; i++) printf " clean_%s", $i
        printf "\n\tcd %s; $(MAKE) clean\n\n", $3
        printf "depend_%s:", $2
        for (i = 4; i <= NF; i++) printf " depend_%s", $i
        printf "\n\tcd %s; $(MAKE) depend\n\n", $3
        printf("else\nclean:");
        for (i = 4; i <= NF; i++) printf " clean_%s", $i
        printf("\ndepend:");
        for (i = 4; i <= NF; i++) printf " depend_%s", $i
        printf("\n");
        next 
} 
/^PACKAGE.*/ {
        printf "%s:", $2
        for (i = 3; i <= NF; i++) printf " %s", $i
        printf "\nclean_%s:", $2
        for (i = 3; i <= NF; i++) printf " clean_%s", $i
        printf "\ndepend_%s:", $2
        for (i = 3; i <= NF; i++) printf " depend_%s", $i
        printf("\n");
        next 
} 
{print} ' modules.awk > modules.mk