add support for .git/last_commit_info generated by bitbake with latest "hack"
[enigma2.git] / main / Makefile.am
1 AM_CPPFLAGS = \
2         -I$(top_srcdir) \
3         -I$(top_srcdir)/include \
4         -include Python.h \
5         -include $(top_builddir)/enigma2_config.h
6
7 AM_CXXFLAGS = \
8         $(LIBSDL_CFLAGS)
9
10 bin_PROGRAMS = enigma2
11
12 enigma2_SOURCES = \
13         bsod.cpp \
14         bsod.h \
15         enigma.cpp \
16         xmlgenerator.cpp \
17         xmlgenerator.h \
18         version_info.cpp \
19         version_info.h \
20         version.h
21
22 EXTRA_DIST = \
23         enigma-dvbtest.cpp \
24         enigma-gdi.cpp \
25         enigma-gui.cpp \
26         enigma-playlist.cpp \
27         enigma-scan.cpp
28
29 enigma2_LDADD_WHOLE = \
30         $(top_builddir)/lib/actions/libenigma_actions.a \
31         $(top_builddir)/lib/base/libenigma_base.a \
32         $(top_builddir)/lib/components/libenigma_components.a \
33         $(top_builddir)/lib/driver/libenigma_driver.a \
34         $(top_builddir)/lib/mmi/libenigma_mmi.a \
35         $(top_builddir)/lib/dvb/libenigma_dvb.a \
36         $(top_builddir)/lib/dvb_ci/libenigma_dvb_ci.a \
37         $(top_builddir)/lib/gdi/libenigma_gdi.a \
38         $(top_builddir)/lib/gui/libenigma_gui.a \
39         $(top_builddir)/lib/python/libenigma_python.a \
40         $(top_builddir)/lib/nav/libenigma_nav.a \
41         $(top_builddir)/lib/service/libenigma_service.a
42
43 enigma2_LDADD = \
44         @BASE_LIBS@ \
45         @LIBGIF_LIBS@ \
46         @LIBJPEG_LIBS@ \
47         @LIBSDL_LIBS@ \
48         @LIBXINE_LIBS@ \
49         @LIBXMLCCWRAP_LIBS@ \
50         @PTHREAD_LIBS@ \
51         @PYTHON_LDFLAGS@
52
53 enigma2_LDFLAGS = -Wl,--export-dynamic
54
55 if HAVE_GIT_DIR
56 GIT_DIR = $(top_srcdir)/.git
57 GIT = git --git-dir=$(GIT_DIR)
58
59 if HAVE_FAKE_GIT_DIR
60 ENIGMA2_DATE = `cat $(GIT_DIR)/last_commit_info | grep 'Date:' | cut -d' ' -f4`
61 ENIGMA2_COMMIT_DATE = `cat $(GIT_DIR)/last_commit_info | grep 'CommitDate:' | cut -d' ' -f2`
62 ENIGMA2_BRANCH = `cat $(GIT_DIR)/branch`
63 else
64 ENIGMA2_DATE =
65 ENIGMA2_COMMIT_DATE = `$(GIT) log --no-color -n 1 --pretty=format:%cd --date=short`
66 ENIGMA2_BRANCH = `$(GIT) branch --no-color 2>/dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'`
67 ENIGMA2_REV = `$(GIT) describe --abbrev=7 --always --long --tags`
68 endif
69
70 BUILT_SOURCES = version-intermediate.h
71 .INTERMEDIATE: version-intermediate.h
72 .PHONY: version-intermediate.h
73 version-intermediate.h:
74         $(AM_V_GEN)touch $@
75         if [ -n "$(ENIGMA2_COMMIT_DATE)" ]; then \
76                 $(AM_V_at)[ -n "$(ENIGMA2_COMMIT_DATE)" ] && echo "#define ENIGMA2_LAST_CHANGE_DATE \"$(ENIGMA2_COMMIT_DATE)\"" >> $@; \
77         else \
78                 $(AM_V_at)[ -n "$(ENIGMA2_DATE)" ] && echo "#define ENIGMA2_LAST_CHANGE_DATE \"$(ENIGMA2_DATE)\"" >> $@; \
79         fi;
80         $(AM_V_at)[ -n "$(ENIGMA2_BRANCH)" ] && echo "#define ENIGMA2_BRANCH \"$(ENIGMA2_BRANCH)\"" >> $@
81         -$(AM_V_at)[ -n "$(ENIGMA2_REV)" ] && echo "#define ENIGMA2_REV \"$(ENIGMA2_REV)\"" >> $@
82         $(AM_V_at)([ -f version.h ] && diff -q version.h $@ >/dev/null) || $(INSTALL_HEADER) $@ version.h
83 endif
84
85 enigma2$(EXEEXT): $(enigma2_OBJECTS) $(enigma2_DEPENDENCIES) $(enigma2_LDADD_WHOLE)
86         $(AM_V_CXXLD)$(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ $(enigma2_LDFLAGS) $(enigma2_OBJECTS) \
87                 -Wl,--whole-archive $(enigma2_LDADD_WHOLE) -Wl,--no-whole-archive $(enigma2_LDADD) $(LIBS)