1# Process this file with automake to generate Makefile.in
2
3AUTOMAKE_OPTIONS = dejagnu
4
5# Install all the associated data files
6SUBDIRS = doc # testsuite example
7
8# Install the bourne shell script driver in the bindir
9bin_SCRIPTS = runtest
10
11# Install the main DejaGnu expect file in the datadir
12pkgdata_SCRIPTS = runtest.exp
13
14# Install config.guess too, so we can use it to figure out what type
15# of machine we're running on.
16libexecdir = $(pkgdatadir)/libexec
17libexec_SCRIPTS = config.guess
18
19DATE = `date "+%Y%m%d`
20
21TLCSH = @TCLSH@
22PKGDIR = /opt
23
24RUNTESTDEFAULTFLAGS = --srcdir $(srcdir)/testsuite RUNTEST=$(RUNTEST)
25RUNTEST = ` \
26  if [ -f ${srcdir}/runtest$(EXEEXT) ] ; then \
27    echo ${srcdir}/runtest$(EXEEXT); \
28  else echo "ERROR: runtest not found" ; exit 1; fi`
29
30CLEANFILES = x.log x.sum site.bak setval.tmp
31check-DEJAGNU:
32	cd testsuite ; $(MAKE) check
33	cd example ; $(MAKE) check
34
35# Since we don't use SUBDIRS, we have to manually clean the
36# subdirectories. We don't use SUBDIRS, so the example or test cases
37# don't get built by default for a "make all".
38clean-local:
39	cd doc       ; $(MAKE) clean
40	cd testsuite ; $(MAKE) clean
41	cd example   ; $(MAKE) clean
42
43# Set ourselves up to build an RPM
44tarball: book1.html overview.ps overview.pdf
45	-rm -fr dejagnu-${VERSION}
46	cp -fpPR $(srcdir) dejagnu-${VERSION}
47	src=$(srcdir); \
48	dir=`(cd $${src}; pwd)`; \
49	(cd dejagnu-${VERSION} ; $${dir}/Clean.tcl); \
50	  cp -R $(srcdir)/doc/html dejagnu-${VERSION}/doc/; \
51	  cp $(srcdir)/doc/overview.ps dejagnu-${VERSION}/doc/; \
52	  cp $(srcdir)/doc/overview.pdf dejagnu-${VERSION}/doc/; \
53	  cp $(srcdir)/doc/overview.rtf dejagnu-${VERSION}/doc/; \
54	  tar cvf ../dejagnu-${VERSION}.tar dejagnu-${VERSION}; \
55	  gzip -9fv ../dejagnu-${VERSION}.tar
56
57rpmspec: $(srcdir)/packaging/rpm/dejagnu.spec
58	cp -f $(srcdir)/packaging/rpm/dejagnu.spec /usr/src/redhat/SPECS/
59
60# Build an RPM package
61rpm: tarball rpmspec
62	cp -f ../dejagnu-${VERSION}.tar.gz /usr/src/redhat/SOURCES/
63	rpm -ba /usr/src/redhat/SPECS/dejagnu.spec
64
65# Build a Debian deb package
66deb: book1.html overview.ps overview.pdf
67	-rm -fr dejagnu-${VERSION}
68	cp -fpr $(srcdir) dejagnu-${VERSION}
69	@echo "clean up stuff we don't want in the source file"
70	src=$(srcdir); \
71	dir=`(cd $${src}; pwd)`; \
72	(cd dejagnu-${VERSION} ; $${dir}/Clean.tcl);
73	-mkdir -p doc/html;
74	-cp -fr $(srcdir)/packaging/deb dejagnu-${VERSION}/
75	-cp -fr doc/html dejagnu-${VERSION}/doc/;
76	-cp -fr doc/overview.ps dejagnu-${VERSION}/doc/;
77	-cp -fr doc/overview.pdf dejagnu-${VERSION}/doc/;
78	-cp -fr doc/overview.rtf dejagnu-${VERSION}/doc/;
79	(cd dejagnu-${VERSION}; dpkg-buildpackage)
80
81# Build a Solaris package
82solpkg: $(srcdir)/packaging/pkg/prototype
83	if test ! -d $(PKGDIR)/dejagnu; then \
84	  rm -fr dejagnu-${VERSION}; \
85	  mkdir dejagnu-${VERSION}; \
86	  cd dejagnu-${VERSION}; \
87	  $(srcdir)/configure -v --prefix $(PKGDIR)/dejagnu; \
88	  make install ; \
89	fi
90	cp $(srcdir)/packaging/pkg/prototype /tmp
91	cp $(srcdir)/packaging/pkg/pkginfo /tmp
92	here=`pwd`; \
93	  cd /tmp; \
94	  pkgmk -o -r / -d /tmp; \
95	  tar cf $$here/dejagnu-${VERSION}.SPARC.2.8.pkg.tar DejaGnu; \
96	  gzip -9fv  $$here/dejagnu-${VERSION}.SPARC.2.8.pkg.tar
97	rm -fr /tmp/prototype /tmp/pkginfo /tmp/DejaGnu
98
99# Build a HP depot package
100hpdepot: # $(srcdir)/packaging/depot/dejagnu.psf
101	if test ! -d $(PKGDIR)/dejagnu; then \
102	rm -fr dejagnu-${VERSION}; \
103	mkdir dejagnu-${VERSION}; \
104	cd dejagnu-${VERSION}; \
105	$(srcdir)/configure -v --prefix $(PKGDIR)/dejagnu; \
106	make install ; \
107	fi
108	swpackage -s $(srcdir)/packaging/depot/dejagnu.psf -x target_type=directory -d /tmp
109	here=`pwd`; \
110	cd /tmp; \
111	tar cf $$here/dejagnu-${VERSION}.hpux11.depot dejagnu; \
112	gzip -9fv  $$here/dejagnu-${VERSION}.hpux11.depot; \
113	rm -fr /tmp/dejagnu
114
115book1.html overview.ps overview.pdf install-doc:
116	cd doc && $(MAKE) $(FLAGS_TO_PASS) $@
117
118# Automake sucks when it comes to building a distribution, so
119# we just copy the source tree onto of what Automake did, and
120# then we Clean it. Automake only includes the source files.
121# We want all the testsuites, data files, and html versions of the doc.
122dist-hook: rpmspec book1.html overview.ps overview.pdf
123	-rm -fr $(distdir)
124	cp -fpr $(srcdir) $(distdir)
125	(cd $(distdir) ; $(TCLSH) $(srcdir)/Clean.tcl)
126	-cp -fr doc/html $(distdir)/doc/
127	-cp -fr doc/overview.ps $(distdir)/doc/
128	-cp -fr doc/overview.pdf $(distdir)/doc/
129
130# Below, host-independent data files that need to get installed.
131# We do it this way so we can use globbing.
132
133lib_dest = $(DESTDIR)$(pkgdatadir)
134lib_files = $(srcdir)/*.c $(srcdir)/lib/*.exp
135
136baseboards_dest = $(DESTDIR)$(pkgdatadir)/baseboards
137baseboards_files = $(srcdir)/baseboards/README $(srcdir)/baseboards/*.exp
138
139include_dest = $(DESTDIR)$(includedir)
140config_dest = $(DESTDIR)$(pkgdatadir)/config
141config_files = $(srcdir)/config/README $(srcdir)/config/*.exp
142
143install-data-local:
144	$(mkinstalldirs) $(lib_dest) $(include_dest)
145	for f in $(lib_files); do \
146	  test ! -f "$$f" || $(INSTALL_DATA) $$f $(lib_dest); \
147	done
148	$(mkinstalldirs) $(baseboards_dest)
149	for f in $(baseboards_files); do \
150	  test ! -f "$$f" || $(INSTALL_DATA) $$f $(baseboards_dest); \
151	done
152	$(INSTALL_DATA) $(srcdir)/dejagnu.h $(include_dest); \
153	$(mkinstalldirs) $(config_dest)
154	for f in $(config_files); do \
155	  test ! -f "$$f" || $(INSTALL_DATA) $$f $(config_dest); \
156	done
157
158uninstall-local:
159	for f in $(lib_files); do \
160	  test ! -f "$$f" || rm -f $(lib_dest)/`basename "$$f"`; \
161	done
162	for f in $(config_files); do \
163	  test ! -f "$$f" || rm -f $(config_dest)/`basename "$$f"`; \
164	done
165	for f in $(baseboards_files); do \
166	  test ! -f "$$f" || rm -f $(baseboards_dest)/`basename "$$f"`; \
167	done
168
169	for f in $(baseboards_files); do \
170	  test ! -f "$$f" || rm -f $(baseboards_dest)/`basename "$$f"`; \
171	done
172	rm -f $(include_dest)/dejagnu.h;
173
174site.exp: Makefile
175	@echo 'Making a new site.exp file...'
176	@test ! -f site.bak || rm -f site.bak
177	@echo '## these variables are automatically generated by make ##' > $@-t
178	@echo '# Do not edit here.  If you wish to override these values' >> $-t
179	@echo '# edit the last section' >> $@-t
180	@echo 'set srcdir $(srcdir)' >> $@-t
181	@echo 'set objdir' `pwd` >> $@-t
182	@echo '## All variables above are generated by configure. Do Not Edit ##' >> $@-t
183	@test ! -f site.exp || sed '1,/^## All variables above are.*##/ d' site.exp >> $@-t
184	@test ! -f site.exp || mv site.exp site.bak
185	@mv $@-t site.exp
186