build: make the "rpm" rule work once again
[iwhd.git] / Makefile.am
blob4360dd455841f302c5ab9e34b1e4db3b92586b7e
1 # Copyright (C) 2010 Red Hat, Inc.
3 # This program is free software: you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation, either version 3 of the License, or
6 # (at your option) any later version.
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
18 # FIXME: don't hard-code 2.0
19 AM_CPPFLAGS     = -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
21 iwhd_YFLAGS = -d
23 SUBDIRS = lib . t man gnulib-tests
24 ACLOCAL_AMFLAGS = -I m4
26 # iwhd is short for Image WareHouse Daemon.
27 bin_PROGRAMS = iwhd
29 EXTRA_DIST =            \
30   iwhd-qparser.h        \
31   iwhd.spec             \
32   iwhd.spec.in
34 BUILT_SOURCES = iwhd-qparser.h qlexer.c
36 MOSTLYCLEANFILES =
37 MAINTAINERCLEANFILES =
39 iwhd_SOURCES = \
40   auto.c        \
41   backend.c     \
42   backend.h     \
43   iwh.h         \
44   meta.cpp      \
45   meta.h        \
46   mpipe.c       \
47   mpipe.h       \
48   replica.c     \
49   replica.h     \
50   qparser.y     \
51   query.h       \
52   rest.c        \
53   setup.c       \
54   setup.h       \
55   state_defs.h  \
56   template.c    \
57   template.h
59 EXTRA_iwhd_SOURCES = qlexer.l
61 VERSION_no_hyphen = $$(echo $(VERSION)|tr - _)
63 MOSTLYCLEANFILES += iwhd.spec
64 MAINTAINERCLEANFILES += iwhd.spec
65 iwhd.spec: iwhd.spec.in Makefile
66         rm -f $@-t $@
67         v=$$(echo $(VERSION)|tr - .); \
68         sed 's/[@]VERSION@/'"$$v"/ $< > $@-t
69         chmod a=r $@-t
70         mv $@-t $@
72 # The following rule accommodates pre-release version number strings
73 # like "0.0.273-1621" that contain a "-".  Repack the tarball
74 # to one with "." substituted for any - in the version string.
75 .PHONY: rpm
76 rpm: dist iwhd.spec
77         chmod 644 $(distdir).tar.gz
78         case $(VERSION) in                                      \
79           *-*)                                                  \
80             v=$$(echo $(VERSION)|tr - .);                       \
81             base=$(PACKAGE)-$$v;                                \
82             tgz=$$base.tar.gz;                                  \
83             tar xf $(distdir).tar.gz                            \
84               && rm -rf $$base $$tgz                            \
85               && mv $(distdir) $$base                           \
86               && tar -czf - $$base > $$tgz                      \
87               && rpmbuild -ta $$tgz; e=$$?                      \
88             rm -rf $$base $$tgz;                                \
89             exit $$e                                            \
90             ;;                                                  \
91           *) rpmbuild -ta $(distdir).tar.gz ;;                  \
92         esac
94 iwhd_CPPFLAGS   = $(HAIL_CFLAGS) -I$(top_srcdir)/lib
95 iwhd_LDADD =            \
96   lib/libiwhd.a         \
97   -lmongoclient         \
98   $(BOOST_SYSTEM_LIB)   \
99   $(BOOST_THREAD_LIB)   \
100   $(CURL_LIB)           \
101   $(JANSSON_LIB)        \
102   $(UHTTPD_LIB)         \
103   $(PTHREAD_LIB)        \
104   $(XML2_LIB)           \
105   $(GLIB2_LIB)          \
106   $(HAIL_LIBS)
108 MOSTLYCLEANFILES += qlexer.c
109 MAINTAINERCLEANFILES += qlexer.c
110 EXTRA_DIST += qlexer.c