1mydir=util$(S)profile
2BUILDTOP=$(REL)..$(S)..
3SUBDIRS=testmod
4PROG_LIBPATH=-L$(TOPLIBD) $(TCL_LIBPATH) -L.
5PROG_RPATH=$(KRB5_LIBDIR)$(TCL_RPATH)
6##DOS##BUILDTOP = ..\..
7##DOS##OBJFILE=$(OUTPRE)profile.lst
8##DOS##LIBNAME=$(OUTPRE)profile.lib
9
10LOCALINCLUDES=-I. $(TCL_INCLUDES)
11# for tcl.h
12DEFINES=-DHAS_STDARG -DLIBDIR=\"$(KRB5_LIBDIR)\"
13
14STLIBOBJS = \
15	prof_tree.o \
16	prof_file.o \
17	prof_parse.o \
18	prof_get.o \
19	prof_set.o \
20	prof_err.o \
21	prof_init.o
22
23OBJS = $(OUTPRE)prof_tree.$(OBJEXT) \
24	$(OUTPRE)prof_file.$(OBJEXT) \
25	$(OUTPRE)prof_parse.$(OBJEXT) \
26	$(OUTPRE)prof_get.$(OBJEXT) \
27	$(OUTPRE)prof_set.$(OBJEXT) \
28	$(OUTPRE)prof_err.$(OBJEXT) \
29	$(OUTPRE)prof_init.$(OBJEXT)
30
31SRCS = $(srcdir)/prof_tree.c \
32	$(srcdir)/prof_file.c \
33	$(srcdir)/prof_parse.c \
34	$(srcdir)/prof_get.c \
35	$(srcdir)/prof_set.c \
36	prof_err.c \
37	$(srcdir)/prof_init.c
38
39EXTRADEPSRCS=$(srcdir)/test_load.c $(srcdir)/test_parse.c \
40	$(srcdir)/test_profile.c $(srcdir)/test_vtable.c \
41	$(srcdir)/profile_tcl.c
42
43DEPLIBS = $(COM_ERR_DEPLIB) $(SUPPORT_DEPLIB)
44MLIBS = -lcom_err $(SUPPORT_LIB) $(LIBS)
45
46LIBBASE=profile
47LIBMAJOR=1
48LIBMINOR=1
49SHLIB_EXPDEPS = $(COM_ERR_DEPLIB) $(SUPPORT_DEPLIB)
50SHLIB_EXPLIBS = -lcom_err $(SUPPORT_LIB) $(LIBS)
51
52PROFILE_HDR=$(BUILDTOP)$(S)include$(S)profile.h
53
54all-unix: includes
55all-unix: all-libs
56all-windows: $(PROFILE_HDR)
57
58install-headers-unix: includes
59
60generate-files-mac: profile.h
61
62$(PROFILE_HDR): profile.h
63	$(CP) profile.h "$@"
64
65includes: $(PROFILE_HDR)
66
67clean-unix::
68	$(RM) $(BUILDTOP)/include/profile.h test2.ini test3.ini test2.ini.bak
69
70##DOS##LIBOBJS = $(OBJS)
71
72
73awk-windows:
74	$(AWK) -f $(BUILDTOP)/util/et/et_h.awk outfile=prof_err.h prof_err.et
75	$(AWK) -f $(BUILDTOP)/util/et/et_c.awk outfile=prof_err.c prof_err.et
76	if exist prof_err.h copy profile.hin+prof_err.h profile.h
77	if exist profile.h copy profile.h $(BUILDTOP)\include\profile.h
78
79test_parse: test_parse.$(OBJEXT) $(OBJS) $(DEPLIBS)
80	$(CC_LINK) -o test_parse test_parse.$(OBJEXT) $(OBJS) $(MLIBS)
81
82test_profile: test_profile.$(OBJEXT) argv_parse.$(OBJEXT) $(OBJS) $(DEPLIBS)
83	$(CC_LINK) -o test_profile test_profile.$(OBJEXT) \
84		argv_parse.$(OBJEXT) $(OBJS) $(MLIBS)
85
86test_vtable: test_vtable.$(OBJEXT) $(OBJS) $(DEPLIBS)
87	$(CC_LINK) -o test_vtable test_vtable.$(OBJEXT) $(OBJS) $(MLIBS)
88
89test_load: test_load.$(OBJEXT) $(OBJS) $(DEPLIBS)
90	$(CC_LINK) -o test_load test_load.$(OBJEXT) $(OBJS) $(MLIBS)
91
92modtest.conf:
93	echo "module `pwd`/testmod/proftest$(DYNOBJEXT):teststring" > $@
94
95.d: includes
96
97# NEED TO FIX!!
98$(OUTPRE)test_parse.exe:
99	$(CC) $(CFLAGS2) -o test_parse.exe test_parse.c \
100		prof_parse.c prof_tree.c /link /stack:16384
101
102# NEED TO FIX!!
103$(OUTPRE)test_profile.exe:
104	$(CC) $(CFLAGS2) -o test_profile.exe test_profile.c prof_init.c \
105		prof_file.c prof_parse.c prof_tree.c /link /stack:16384
106
107##DOS##!if 0
108profile.h: prof_err.h profile.hin
109	cat $(srcdir)/profile.hin prof_err.h > $@
110##DOS##!endif
111##DOS##profile.h: prof_err.h profile.hin
112##DOS##	copy /b profile.hin+prof_err.h $@
113
114prof_err.h: $(srcdir)/prof_err.et
115
116prof_err.c: $(srcdir)/prof_err.et
117
118prof_err.o: prof_err.c
119
120# not built by default, but may be useful for testing
121$(srcdir)/profile_tcl.c: profile.swg
122#	(cd $(srcdir) && swig -tcl8 -nosafe -o profile_tcl.c profile.swg)
123profile_tcl.o: $(srcdir)/profile_tcl.c profile.h
124profile_tcl: profile_tcl.o $(PROF_DEPLIB) $(COM_ERR_DEPLIB) $(SUPPORT_DEPLIB)
125	$(CC_LINK) -o profile_tcl profile_tcl.o \
126		$(TCL_MAYBE_RPATH) \
127		-L../et -L../.. -lprofile $(TCL_LIBS) $(MLIBS)
128
129clean-unix:: clean-libs clean-libobjs
130	$(RM) $(PROGS) *.o *~ core prof_err.h profile.h prof_err.c
131	$(RM) test_load test_parse test_profile test_vtable profile_tcl
132	$(RM) modtest.conf testinc.ini testinc2.ini final.out
133	$(RM) -r test_include_dir
134
135clean-windows::
136	$(RM) $(PROFILE_HDR)
137
138check-unix: test_parse test_profile test_vtable test_load modtest.conf
139	$(RUN_TEST) ./test_vtable
140	$(RUN_TEST) ./test_load
141
142DO_TCL=@DO_TCL@
143check-unix: check-unix-final check-unix-tcl-$(DO_TCL)
144
145F1=$(srcdir)/final1.ini
146F2=$(srcdir)/final2.ini
147F3=$(srcdir)/final3.ini
148F4=$(srcdir)/final4.ini
149F5=$(srcdir)/final5.ini
150QUERY=query section subsection key
151check-unix-final: test_profile
152	$(RM) final.out
153	(echo; $(RUN_TEST) ./test_profile $(F1):$(F1) $(QUERY)) > final.out
154	(echo; $(RUN_TEST) ./test_profile $(F2):$(F1) $(QUERY)) >> final.out
155	(echo; $(RUN_TEST) ./test_profile $(F3):$(F1) $(QUERY)) >> final.out
156	(echo; $(RUN_TEST) ./test_profile $(F4):$(F1) $(QUERY)) >> final.out
157	(echo; $(RUN_TEST) ./test_profile $(F5):$(F1) $(QUERY)) >> final.out
158	cmp final.out $(srcdir)/final.expected
159	$(RM) final.out
160
161check-unix-tcl-:
162	@echo "+++"
163	@echo "+++ Tcl not available, some profile tests not run."
164	@echo "+++"
165
166check-unix-tcl-ok: profile_tcl
167	cp $(srcdir)/test.ini test2.ini
168	$(RUN_TEST) ./profile_tcl $(srcdir)/prof_test1
169
170check-windows: $(OUTPRE)test_profile.exe $(OUTPRE)test_parse.exe
171	$(RM) $(OUTPRE)*.obj
172	$(OUTPRE)test_parse test.ini
173
174
175@lib_frag@
176@libobj_frag@
177
178