19c158caa68012ff2bfc1e1c70323601cfc8def5
[abstract.git] / check.mk
blob19c158caa68012ff2bfc1e1c70323601cfc8def5
1 #!/usr/bin/make -f
2 # check.mk -- Run make -f check.mk for integrated unit testing
3 # Copyright (C) 2007 Sergey Yanovich
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 top_srcdir := $(shell cd .. && pwd)
20 HOST_OS_GUESS=$(shell ../build/autoconf/config.guess)
21 HOST_OS=$(shell ../build/autoconf/config.sub $(HOST_OS_GUESS))
23 ifneq (,$(findstring mingw,$(HOST_OS)))
24 OS_ARCH=w32
25 LIBXULPATH=/src/xulrunner-build/dist/
26 else
27 ifneq (,$(findstring linux,$(HOST_OS)))
28 OS_ARCH=linux
29 LIBXULPATH=$(shell PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig pkg-config --variable=sdkdir libxul)
30 else
31 $(error "platform not supported, yet")
32 endif
33 endif
35 all: build
37 setup: objdir/Makefile
39 mozconfig: app/test/unit/mozconfig.$(OS_ARCH)
40 cp $< $@
42 objdir/Makefile: mozconfig $(top_srcdir)/configure $(top_srcdir)/nsprpub/configure
43 test -d objdir || mkdir objdir
44 echo $(LIBXULPATH)
45 cd objdir && \
46 MOZCONFIG=$(top_srcdir)/abstract/mozconfig $(top_srcdir)/configure \
47 --with-libxul-sdk=$(LIBXULPATH)
48 touch $@
50 $(top_srcdir)/configure: $(top_srcdir)/configure.in
51 cd $(top_srcdir) && autoconf
53 $(top_srcdir)/nsprpub/configure: $(top_srcdir)/nsprpub/configure.in
54 cd $(top_srcdir)/nsprpub && autoconf
56 objdir/nsprpub/config/nspr-config: objdir/Makefile
57 test -d objdir/nsprpub/config || mkdir -p objdir/nsprpub/config
58 cp nspr-config $@
60 build: objdir/Makefile objdir/nsprpub/config/nspr-config
61 $(MAKE) -C objdir
63 clean: objdir/Makefile
64 $(MAKE) -C objdir clean
66 install: objdir/Makefile
67 $(MAKE) -C objdir install
69 objpkg/Makefile: $(top_srcdir)/configure
70 test -d objpkg || mkdir objpkg
71 cd objpkg && \
72 MOZCONFIG=$(top_srcdir)/abstract/installer/mozconfig $(top_srcdir)/configure \
73 --with-libxul-sdk=$(LIBXULPATH)
75 installer: objpkg/Makefile
76 $(MAKE) -C objpkg
77 $(MAKE) -C objpkg installer
79 package: objpkg/Makefile
80 $(MAKE) -C objpkg
81 $(MAKE) -C objpkg package
83 .PHONY: all setup clean build install package installer