s4:torture: Adapt KDC canon test to Heimdal upstream changes
[samba.git] / source4 / heimdal / lib / hdb / NTMakefile
1 ########################################################################
2 #
3 # Copyright (c) 2009, Secure Endpoints Inc.
4 # All rights reserved.
5
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9
10 # - Redistributions of source code must retain the above copyright
11 #   notice, this list of conditions and the following disclaimer.
12
13 # - Redistributions in binary form must reproduce the above copyright
14 #   notice, this list of conditions and the following disclaimer in
15 #   the documentation and/or other materials provided with the
16 #   distribution.
17
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
30
31
32 RELDIR=lib\hdb
33
34 !include ../../windows/NTMakefile.w32 
35
36 gen_files_hdb = $(OBJ)\asn1_hdb_asn1.x
37
38 $(gen_files_hdb) $(OBJ)\hdb_asn1.hx $(OBJ)\hdb_asn1-priv.hx: $(BINDIR)\asn1_compile.exe hdb.asn1
39         cd $(OBJ)
40         $(BINDIR)\asn1_compile.exe --sequence=HDB-extensions --sequence=HDB-Ext-KeyRotation --sequence=HDB-Ext-KeySet --sequence=Keys --one-code-file $(SRCDIR)\hdb.asn1 hdb_asn1
41         cd $(SRCDIR)
42
43 $(gen_files_hdb:.x=.c): $$(@R).x
44
45 !ifdef OPENLDAP_MODULE
46
47 ldap_dll = $(BINDIR)\hdb_ldap.dll
48 ldap_lib = $(LIBDIR)\hdb_ldap.lib
49 ldap_objs = $(OBJ)\hdb-ldap.obj
50
51 $(ldap_dll): $(ldap_objs)
52         $(DLLGUILINK) -implib:$(ldap_lib)
53         $(DLLPREP)
54
55 clean::
56         -$(RM) $(ldap_dll)
57         -$(RM) $(ldap_lib)
58
59 !else
60
61 ldap = $(OBJ)\hdb-ldap.obj
62 ldap_c = hdb-ldap.c
63
64 !endif
65
66 dist_libhdb_la_SOURCES =                        \
67         common.c                                \
68         db.c                                    \
69         db3.c                                   \
70         ext.c                                   \
71         $(ldap_c)                               \
72         hdb.c                                   \
73         hdb-sqlite.c                            \
74         hdb-keytab.c                            \
75         hdb-mitdb.c                             \
76         hdb-mdb.c                               \
77         hdb_locl.h                              \
78         keys.c                                  \
79         keytab.c                                \
80         dbinfo.c                                \
81         mkey.c                                  \
82         ndbm.c                                  \
83         print.c
84
85 libhdb_OBJs = \
86         $(OBJ)\common.obj       \
87         $(OBJ)\db.obj           \
88         $(OBJ)\db3.obj          \
89         $(OBJ)\ext.obj          \
90         $(ldap)                 \
91         $(OBJ)\hdb.obj          \
92         $(OBJ)\hdb-sqlite.obj   \
93         $(OBJ)\hdb-keytab.obj   \
94         $(OBJ)\hdb-mitdb.obj    \
95         $(OBJ)\keys.obj         \
96         $(OBJ)\keytab.obj       \
97         $(OBJ)\dbinfo.obj       \
98         $(OBJ)\mkey.obj         \
99         $(OBJ)\ndbm.obj         \
100         $(OBJ)\print.obj        \
101         $(gen_files_hdb:.x=.obj)        \
102         $(OBJ)\hdb_err.obj
103
104 $(OBJ)\hdb_err.c $(OBJ)\hdb_err.h: hdb_err.et
105         cd $(OBJ)
106         $(BINDIR)\compile_et.exe $(SRCDIR)\hdb_err.et
107         cd $(SRCDIR)
108
109 $(OBJ)\hdb-protos.h: $(dist_libhdb_la_SOURCES)
110         $(PERL) ../../cf/make-proto.pl -q -P remove -o $@ $(dist_libhdb_la_SOURCES) \
111                 || $(RM) $@
112
113 $(OBJ)\hdb-private.h: $(dist_libhdb_la_SOURCES)
114         $(PERL) ../../cf/make-proto.pl -q -P remote -p $@ $(dist_libhdb_la_SOURCES) \
115                 || $(RM) $@
116
117 INCFILES=                       \
118         $(INCDIR)\hdb.h         \
119         $(INCDIR)\hdb-protos.h  \
120         $(OBJ)\hdb-private.h    \
121         $(INCDIR)\hdb_err.h     \
122         $(INCDIR)\hdb_asn1.h    \
123         $(INCDIR)\hdb_asn1-priv.h
124
125 !ifndef STATICLIBS
126
127 RES=$(OBJ)\libhdb-version.res
128
129 $(LIBHDB): $(BINDIR)\libhdb.dll
130
131 $(BINDIR)\libhdb.dll: $(libhdb_OBJs) $(ldap_lib) $(LIBHEIMBASE) $(LIBHEIMDAL) $(LIBSQLITE) $(LIBCOMERR) $(LIBROKEN) $(RES)
132         $(DLLGUILINK) -def:libhdb-exports.def -implib:$(LIBHDB)
133         $(DLLPREP_NODIST)
134
135 clean::
136         -$(RM) $(BINDIR)\libhdb.*
137
138 !else
139
140 $(LIBHDB): $(libhdb_OBJs) $(ldap_lib)
141         $(LIBCON)
142
143 !endif
144
145 all:: $(INCFILES) $(LIBHDB)
146
147 clean::
148         -$(RM) $(INCFILES)
149         -$(RM) $(LIBHDB)
150
151 test:: test-binaries test-run
152
153 test-binaries: $(OBJ)\test_dbinfo.exe $(OBJ)\test_hdbkeys.exe $(OBJ)\test_namespace.exe
154
155 $(OBJ)\test_dbinfo.exe: $(OBJ)\test_dbinfo.obj $(LIBHDB) $(LIBHEIMDAL) $(LIBROKEN) $(LIBVERS)
156         $(EXECONLINK)
157         $(EXEPREP_NODIST)
158
159 $(OBJ)\test_hdbkeys.exe: $(OBJ)\test_hdbkeys.obj $(LIBHDB) $(LIBHEIMDAL) $(LIBROKEN) $(LIBVERS)
160         $(EXECONLINK)
161         $(EXEPREP_NODIST)
162
163 $(OBJ)\test_namespace.exe: $(OBJ)\test_namespace.obj $(LIBHDB) $(LIBHEIMDAL) $(LIBHEIMBASE) $(LIBROKEN) $(LIBVERS)
164         $(EXECONLINK)
165         $(EXEPREP_NODIST)
166
167 test-run:
168         cd $(OBJ)
169         -test_dbinfo.exe
170         -test_hdbkeys.exe
171         -test_namespace.exe
172         cd $(SRCDIR)
173
174 !ifdef OPENLDAP_INC
175 openldap_inc_flag=-I$(OPENLDAP_INC)
176 !else
177 openldap_inc_flag=
178 !endif
179
180 hdb_cflags=$(openldap_inc_flag) -I$(OBJ)
181
182 {}.c{$(OBJ)}.obj::
183         $(C2OBJ_P) $(hdb_cflags) -DASN1_LIB
184
185 {$(OBJ)}.c{$(OBJ)}.obj::
186         $(C2OBJ_P) $(hdb_cflags)
187
188 test-exports:
189         $(PERL) ..\..\cf\w32-check-exported-symbols.pl --vs version-script.map --def libhdb-exports.def
190
191 test:: test-exports