aboutsummaryrefslogtreecommitdiff
path: root/src/mac/HeaderFiles.jam
blob: 70bd5c4d00e76600cca0486928bda2094cbc16b5 (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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
include "/Developer/Makefiles/pbx_jamfiles/Jambase" ;

GSSKRB5_TEMP_DIR = "$(SYMROOT)/GSSKerberos5.intermediates" ;

COM_ERR_DIR = "$(SRCROOT)/../util/et" ;
PROFILE_DIR = "$(SRCROOT)/../util/profile" ;
GSS_DIR = "$(SRCROOT)/../lib/gssapi" ;
INCLUDE_DIR = "$(SRCROOT)/../include" ;
ERROR_TABLES_DIR = "$(SRCROOT)/../lib/krb5/error_tables" ;

ERROR_CODE_REGEXP = "/^\\s*#define\\s+\\w+\(\\s+\\(-?\\d+L\\)\)|\(initialize_\\w+_error_table\\(\\)\)\\s*$/" ;
EXTRACT_ERROR_CODES = "perl -e 'while (<STDIN>) { if ($(ERROR_CODE_REGEXP)) { print; } }'" ;

# install and installhdrs depends on the existence of the autogenerated headers
DEPENDS install 	: all ;
DEPENDS installhdrs	: all ;

# all depends on autogenerating the headers in the temporary directory
DEPENDS	all : 		"$(GSSKRB5_TEMP_DIR)"
                    "$(GSSKRB5_TEMP_DIR)/KerberosComErr.h"
                    "$(GSSKRB5_TEMP_DIR)/profile.h"
					"$(GSSKRB5_TEMP_DIR)/KerberosProfile/profile.h"
                    "$(GSSKRB5_TEMP_DIR)/KerberosProfile.h"
                    "$(GSSKRB5_TEMP_DIR)/adm_err.h"
                    "$(GSSKRB5_TEMP_DIR)/asn1_err.h"
                    "$(GSSKRB5_TEMP_DIR)/kdb5_err.h"
                    "$(GSSKRB5_TEMP_DIR)/krb5_err.h"
                    "$(GSSKRB5_TEMP_DIR)/kv5m_err.h"
                    "$(GSSKRB5_TEMP_DIR)/krb5.h"
					"$(GSSKRB5_TEMP_DIR)/Kerberos5/krb5.h"
                    "$(GSSKRB5_TEMP_DIR)/Kerberos5.h"
                    "$(GSSKRB5_TEMP_DIR)/gssapi.h"
                    "$(GSSKRB5_TEMP_DIR)/GSS/gssapi.h"
                    "$(GSSKRB5_TEMP_DIR)/GSS.h"
                    "$(GSSKRB5_TEMP_DIR)/autoconf.h" ;


# Delete these files when we clean
Clean.Remove 	clean : 	"$(GSSKRB5_TEMP_DIR)"
                            "$(GSSKRB5_TEMP_DIR)/KerberosComErr.h"
                            "$(GSSKRB5_TEMP_DIR)/profile.h"
                            "$(GSSKRB5_TEMP_DIR)/KerberosProfile.h"
                            "$(GSSKRB5_TEMP_DIR)/adm_err.h"
                            "$(GSSKRB5_TEMP_DIR)/asn1_err.h"
                            "$(GSSKRB5_TEMP_DIR)/kdb5_err.h"
                            "$(GSSKRB5_TEMP_DIR)/krb5_err.h"
                            "$(GSSKRB5_TEMP_DIR)/kv5m_err.h"
                            "$(GSSKRB5_TEMP_DIR)/krb5.h"
                            "$(GSSKRB5_TEMP_DIR)/Kerberos5.h"
                            "$(GSSKRB5_TEMP_DIR)/gssapi.h"
                            "$(GSSKRB5_TEMP_DIR)/GSS.h"
                            "$(GSSKRB5_TEMP_DIR)/autoconf.h" ;

# JAM rules to autogenerate files

rule KerberosComErr.h
{
    DEPENDS "$(1)" : "$(2)" ;
}

actions KerberosComErr.h
{
    echo "#ifndef __KERBEROSCOMERR__"				> "$(1)" ;
    echo "#define __KERBEROSCOMERR__"				>> "$(1)" ;
    echo ""											>> "$(1)" ;
    echo "#include <KerberosComErr/com_err.h>"		>> "$(1)" ;
    echo ""											>> "$(1)" ;
    echo "#endif /* __KERBEROSCOMERR__ */"			>> "$(1)" ;
}

rule profile.h
{
    DEPENDS "$(1)" : "$(2)" ;
}

actions profile.h
{
    cat "$(2[1])" > "$(1)" ;
    for header in "$(2[2-])" ; do 
        cat $header | $(EXTRACT_ERROR_CODES) >> "$(1)" ;
    done
}

rule KerberosProfile.h
{
    DEPENDS "$(1)" : "$(2)" ;
}

actions KerberosProfile.h
{
    echo "#ifndef __KERBEROSPROFILE__"				> "$(1)" ;
    echo "#define __KERBEROSPROFILE__"				>> "$(1)" ;
    echo ""											>> "$(1)" ;
    echo "#include <KerberosProfile/profile.h>"		>> "$(1)" ;
    echo ""											>> "$(1)" ;
    echo "#endif /* __KERBEROSPROFILE__ */"			>> "$(1)" ;
}

rule krb5.h
{
    DEPENDS "$(1)" : "$(2)" ;
    DEPENDS "$(1)" : "$(PREFIX)" ;
}

actions krb5.h
{
    echo "/* This is the prologue to krb5.h */" > "$(1)" ;
    echo "/* Unfortunately some of these defines are compiler dependent */" >> "$(1)" ;
    grep SIZEOF "$(SRCROOT)/GSSKerberosPrefix.h" >> "$(1)" ;
    grep HAVE_STDARG_H "$(SRCROOT)/GSSKerberosPrefix.h" >> "$(1)" ;
    grep HAVE_SYS_TYPES_H "$(SRCROOT)/GSSKerberosPrefix.h" >> "$(1)" ;
    cat "$(2[1])" >> "$(1)" ;
    for header in "$(2[2-])" ; do
        echo Processing $header
        cat $header | $(EXTRACT_ERROR_CODES) >> "$(1)" ;
    done
}


rule Kerberos5.h
{
    DEPENDS "$(1)" : "$(2)" ;
}

actions Kerberos5.h
{
    echo "#ifndef __KERBEROS5__"				> "$(1)" ;
    echo "#define __KERBEROS5__"				>> "$(1)" ;
    echo ""										>> "$(1)" ;
    echo "#include <Kerberos5/krb5.h>"			>> "$(1)" ;
    echo ""										>> "$(1)" ;
    echo "#endif /* __KERBEROS5__ */"			>> "$(1)" ;
}

rule gssapi.h
{
    DEPENDS "$(1)" : "$(2)" ;
    DEPENDS "$(1)" : "$(PREFIX)" ;
}

actions gssapi.h
{
    echo "/* This is the prologue to gssapi.h */" > "$(1)" ;
    echo "/* It contains some choice pieces of autoconf.h */" >>  "$(1)" ;
    grep SIZEOF "$(SRCROOT)/GSSKerberosPrefix.h" >>  "$(1)" ;
    grep 'HAVE_.*_H' "$(SRCROOT)/GSSKerberosPrefix.h" >>  "$(1)" ;
    grep 'USE_.*_H' "$(SRCROOT)/GSSKerberosPrefix.h" >>  "$(1)" ;
    echo "/* End of gssapi.h prologue. */" >>  "$(1)" ;
    cat "$(2[1])" >> "$(1)" ;
    for header in "$(2[2-])" ; do 
        cat $header | $(EXTRACT_ERROR_CODES) >> "$(1)" ;
    done
}


rule GSS.h
{
    DEPENDS "$(1)" : "$(2)" ;
}

actions GSS.h
{
    echo "#ifndef __GSS__"					> "$(1)" ;
    echo "#define __GSS__"					>> "$(1)" ;
    echo ""									>> "$(1)" ;
    echo "#include <GSS/gssapi.h>"			>> "$(1)" ;
    echo "#include <GSS/gssapi_krb5.h>"		>> "$(1)" ;
    echo ""									>> "$(1)" ;
    echo "#endif /* __GSS__ */"				>> "$(1)" ;
}

rule autoconf.h
{
}

actions autoconf.h
{
    touch "$(1)" ;
}

# Dependencies to make the autogenerated headers in the temporary directory
Mkdir				"$(GSSKRB5_TEMP_DIR)" ;
KerberosComErr.h	"$(GSSKRB5_TEMP_DIR)/KerberosComErr.h" : 	"$(COM_ERR_DIR)/com_err.h" ;
profile.h 			"$(GSSKRB5_TEMP_DIR)/profile.h" : 			"$(PROFILE_DIR)/profile.hin"
                                                                "$(GSSKRB5_TEMP_DIR)/prof_err.h" ;
KerberosProfile.h 	"$(GSSKRB5_TEMP_DIR)/KerberosProfile.h" : 	"$(GSSKRB5_TEMP_DIR)/profile.h" ;
krb5.h				"$(GSSKRB5_TEMP_DIR)/krb5.h" :				"$(INCLUDE_DIR)/krb5.hin" 
                                                                "$(GSSKRB5_TEMP_DIR)/krb5_err.h"
                                                                "$(GSSKRB5_TEMP_DIR)/kdb5_err.h" 
                                                                "$(GSSKRB5_TEMP_DIR)/kv5m_err.h" 
                                                                "$(GSSKRB5_TEMP_DIR)/asn1_err.h" ;
Kerberos5.h 		"$(GSSKRB5_TEMP_DIR)/Kerberos5.h" :			"$(GSSKRB5_TEMP_DIR)/krb5.h" ;
gssapi.h 			"$(GSSKRB5_TEMP_DIR)/gssapi.h" : 			"$(GSS_DIR)/generic/gssapi.hin" ;
GSS.h 				"$(GSSKRB5_TEMP_DIR)/GSS.h" : 				"$(GSSKRB5_TEMP_DIR)/gssapi.h" ;
autoconf.h 			"$(GSSKRB5_TEMP_DIR)/autoconf.h" ;

# We need to also make copies in the appropriate subdirectories, so that <foo/bar.h> paths work
# correctly inside the foo framework target. This is due to a Project Builder bug which causes
# builds to fail if an autogenerated SYMROOT-relative file is added to a target
Mkdir "$(GSSKRB5_TEMP_DIR)/GSS" ;
DEPENDS "$(GSSKRB5_TEMP_DIR)/GSS/gssapi.h" : "$(GSSKRB5_TEMP_DIR)/GSS" ;
Cp	"$(GSSKRB5_TEMP_DIR)/GSS/gssapi.h" : "$(GSSKRB5_TEMP_DIR)/gssapi.h" ;			

Mkdir "$(GSSKRB5_TEMP_DIR)/Kerberos5" ;
DEPENDS "$(GSSKRB5_TEMP_DIR)/Kerberos5/krb5.h" : "$(GSSKRB5_TEMP_DIR)/Kerberos5" ;
Cp	"$(GSSKRB5_TEMP_DIR)/Kerberos5/krb5.h" : "$(GSSKRB5_TEMP_DIR)/krb5.h" ;

Mkdir "$(GSSKRB5_TEMP_DIR)/KerberosProfile" ;
DEPENDS "$(GSSKRB5_TEMP_DIR)/KerberosProfile/profile.h" : "$(GSSKRB5_TEMP_DIR)/KerberosProfile" ;
Cp	"$(GSSKRB5_TEMP_DIR)/KerberosProfile/profile.h" : "$(GSSKRB5_TEMP_DIR)/profile.h" ;