Makefile.am 7.3 KB
Newer Older
Elliot Lee's avatar
Elliot Lee committed
1 2
## Process this file with automake to produce Makefile.in

3
libgimpbase = $(top_builddir)/libgimpbase/libgimpbase-$(GIMP_API_VERSION).la
4
libgimpconfig = $(top_builddir)/libgimpconfig/libgimpconfig-$(GIMP_API_VERSION).la
5 6 7 8 9 10
libgimpcolor = $(top_builddir)/libgimpcolor/libgimpcolor-$(GIMP_API_VERSION).la
libgimpmath = $(top_builddir)/libgimpmath/libgimpmath-$(GIMP_API_VERSION).la
libgimpmodule = $(top_builddir)/libgimpmodule/libgimpmodule-$(GIMP_API_VERSION).la
libgimpwidgets = $(top_builddir)/libgimpwidgets/libgimpwidgets-$(GIMP_API_VERSION).la
libgimpthumb = $(top_builddir)/libgimpthumb/libgimpthumb-$(GIMP_API_VERSION).la

11
# Sort this by architectural dependencies, lowest level at the top,
12 13
# so that when e.g. changing a header-file the subdirs are built in
# the right order
14
SUBDIRS = \
15 16
	config		\
	core		\
17
	operations	\
18 19
	gegl		\
	text		\
20 21
	vectors		\
	paint		\
22
	plug-in		\
23
	xcf		\
24 25 26 27 28 29 30 31 32
	file		\
	pdb		\
	widgets		\
	display		\
	tools		\
	dialogs		\
	actions		\
	menus		\
	gui		\
33
	.		\
34
	tests
Elliot Lee's avatar
Elliot Lee committed
35

36 37 38 39
# Put the GIMP core in a lib so we can conveniently link against that
# in test cases
noinst_LIBRARIES = libapp.a

40
if ENABLE_GIMP_CONSOLE
41
bin_PROGRAMS = gimp-@GIMP_APP_VERSION@ gimp-console-@GIMP_APP_VERSION@
42
else
43
bin_PROGRAMS = gimp-@GIMP_APP_VERSION@
44
endif
Elliot Lee's avatar
Elliot Lee committed
45

46
libapp_sources = \
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
	about.h			\
	app.c			\
	app.h			\
	errors.c		\
	errors.h		\
	language.c		\
	language.h		\
	sanity.c		\
	sanity.h		\
	signals.c		\
	signals.h		\
	tests.c			\
	tests.h			\
	unique.c		\
	unique.h		\
	units.c			\
	units.h			\
	version.c		\
	version.h		\
	gimp-debug.c		\
	gimp-debug.h		\
	gimp-log.c		\
	gimp-log.h		\
	gimp-priorities.h	\
71
	gimp-intl.h
72

73 74 75
libapp_generated_sources = \
	git-version.h

76 77 78 79
# Build git-version.h before anything in the subdirs as this is needed
# in the about dialog.
BUILT_SOURCES = $(libapp_generated_sources)

80 81
CLEANFILES = $(libapp_generated_sources)

82 83 84
$(srcdir)/version.c: git-version.h

libapp_a_SOURCES = $(libapp_sources) $(libapp_generated_sources)
85

86
gimp_@GIMP_APP_VERSION@_SOURCES = $(libapp_sources) main.c
87

88

89
if PLATFORM_OSX
90
framework_cocoa = -framework Cocoa
91 92
endif

93
if OS_WIN32
94
win32_ldflags = -mwindows -Wl,--tsaware $(WIN32_LARGE_ADDRESS_AWARE)
95 96 97 98 99

if HAVE_EXCHNDL
exchndl = -lexchndl
endif

100 101
else
libm = -lm
102
endif
103

104
if USE_BINRELOC
105 106
munix = -Wl,-rpath '-Wl,$$ORIGIN/../lib'
endif
107

108
if HAVE_WINDRES
109
include $(top_srcdir)/build/windows/gimprc.rule
110 111
GIMPRC = gimp-$(GIMP_APP_VERSION).rc.o
GIMPCONSOLERC = gimp-console-$(GIMP_APP_VERSION).rc.o
112 113
endif

114
AM_CPPFLAGS = \
115 116
	-DGIMPDIR=\""$(gimpdir)"\"				\
	-DGIMP_USER_VERSION=\"$(GIMP_USER_VERSION)\"		\
117
	-DG_LOG_DOMAIN=\"Gimp\"		\
118 119 120 121 122
	-DGIMP_APP_GLUE_COMPILATION	\
	-I$(top_srcdir)			\
	$(GTK_CFLAGS)			\
	$(PANGOCAIRO_CFLAGS)		\
	$(GEGL_CFLAGS)			\
123
	$(GEXIV2_CFLAGS)		\
124
	-I$(includedir)			\
125
	-I$(builddir)/gui
Elliot Lee's avatar
Elliot Lee committed
126

127 128 129
# We need this due to circular dependencies
AM_LDFLAGS = \
	$(munix)						\
130 131 132
	-Wl,-u,$(SYMPREFIX)gimp_vectors_undo_get_type		\
	-Wl,-u,$(SYMPREFIX)gimp_vectors_mod_undo_get_type	\
	-Wl,-u,$(SYMPREFIX)gimp_param_spec_duplicate		\
133 134 135 136 137
	-Wl,-u,$(SYMPREFIX)gimp_operations_init			\
	-Wl,-u,$(SYMPREFIX)xcf_init				\
	-Wl,-u,$(SYMPREFIX)internal_procs_init			\
	-Wl,-u,$(SYMPREFIX)gimp_plug_in_manager_restore		\
	-Wl,-u,$(SYMPREFIX)gimp_pdb_compat_param_spec
138 139

gimpconsoleldadd = \
140
	xcf/libappxcf.a			\
141
	pdb/libappinternal-procs.a	\
142
	pdb/libapppdb.a			\
143
	plug-in/libappplug-in.a		\
144
	vectors/libappvectors.a		\
145 146
	core/libappcore.a		\
	file/libappfile.a		\
147
	text/libapptext.a		\
148
	paint/libapppaint.a		\
149
	operations/libappoperations.a	\
Michael Natterer's avatar
Michael Natterer committed
150
	gegl/libappgegl.a		\
151
	config/libappconfig.a		\
152
	$(libgimpconfig)		\
153 154 155 156
	$(libgimpmath)			\
	$(libgimpthumb)			\
	$(libgimpcolor)			\
	$(libgimpmodule)		\
157
	$(libgimpbase)			\
158
	$(GDK_PIXBUF_LIBS)		\
159
	$(FREETYPE_LIBS)		\
160 161
	$(FONTCONFIG_LIBS)		\
	$(PANGOCAIRO_LIBS)		\
162
	$(HARFBUZZ_LIBS)		\
163
	$(CAIRO_LIBS)			\
164 165
	$(GIO_UNIX_LIBS)		\
	$(GIO_WINDOWS_LIBS)		\
166
	$(GEGL_LIBS)			\
167
	$(GLIB_LIBS)			\
168
	$(GEXIV2_LIBS)			\
169
	$(Z_LIBS)			\
170
	$(JSON_C_LIBS)			\
171
	$(LIBMYPAINT_LIBS)		\
172
	$(INTLLIBS)			\
173 174
	$(RT_LIBS)			\
	$(libm)
175

176 177 178
gimp_@GIMP_APP_VERSION@_LDFLAGS = \
	$(AM_LDFLAGS)		\
	$(win32_ldflags)	\
179
	$(framework_cocoa)	\
180
	-Wl,-u,$(SYMPREFIX)gimp_lebl_dialog
181

182
gimp_@GIMP_APP_VERSION@_LDADD = \
183 184 185 186 187 188 189 190 191 192 193 194
	gui/libappgui.a			\
	menus/libappmenus.a		\
	actions/libappactions.a		\
	dialogs/libappdialogs.a		\
	tools/libapptools.a		\
	display/libappdisplay.a		\
	widgets/libappwidgets.a		\
	$(libgimpwidgets)		\
	$(GTK_LIBS)			\
	$(GTK_MAC_INTEGRATION_LIBS)	\
	$(DBUS_GLIB_LIBS)		\
	$(gimpconsoleldadd)		\
195
	$(exchndl)			\
196
	$(GIMPRC)
197

198

199
if ENABLE_GIMP_CONSOLE
200

201
gimp_console_@GIMP_APP_VERSION@_SOURCES = $(libapp_sources) main.c
202

203
gimp_console_@GIMP_APP_VERSION@_CPPFLAGS = \
204 205 206
	$(AM_CPPFLAGS)			\
	-DGIMP_CONSOLE_COMPILATION

207
gimp_console_@GIMP_APP_VERSION@_LDADD = \
208 209
	$(gimpconsoleldadd) \
	$(GIMPCONSOLERC)
210

211 212
endif

213

214 215 216
install-exec-hook:
if DEFAULT_BINARY
	cd $(DESTDIR)$(bindir) \
217
	&& rm -f gimp$(EXEEXT) \
218
	&& $(LN_S) gimp-$(GIMP_APP_VERSION)$(EXEEXT) gimp$(EXEEXT)
219 220 221
if ENABLE_GIMP_CONSOLE
	cd $(DESTDIR)$(bindir) \
	&& rm -f gimp-console$(EXEEXT) \
222
	&& $(LN_S) gimp-console-$(GIMP_APP_VERSION)$(EXEEXT) gimp-console$(EXEEXT)
223
endif
224 225 226 227
endif

uninstall-local:
if DEFAULT_BINARY
228
	rm -f $(DESTDIR)$(bindir)/gimp$(EXEEXT)
229
if ENABLE_GIMP_CONSOLE
230
	rm -f $(DESTDIR)$(bindir)/gimp-console$(EXEEXT)
231
endif
232
endif
233 234


235 236 237 238 239 240 241 242 243
# require gimp-console when making dist
#
if ENABLE_GIMP_CONSOLE
dist-check-gimp-console:
else
dist-check-gimp-console:
	@echo "*** gimp-console must be enabled in order to make dist"
	@false
endif
244

245 246 247 248 249

# hook to assure that the system gimprc and the gimprc manpage are
# uptodate when a release is made
#
dist-dump-gimprc: gimp-console-$(GIMP_APP_VERSION)$(EXEEXT)
250
	./$< --dump-gimprc-system > gimprc.tmp	\
251 252 253 254 255
		&& sed -e "s/num-processors [0-9]*/num-processors 1/"	\
		   gimprc.tmp > gimprc.tmp2				\
		&& (cmp -s gimprc.tmp2 $(top_srcdir)/etc/gimprc ||	\
		    cp gimprc.tmp2 $(top_srcdir)/etc/gimprc)		\
		&& rm gimprc.tmp gimprc.tmp2
256
	./$< --dump-gimprc-manpage > gimprc.tmp	\
257 258 259 260 261
		&& sed -e "s/num-processors [0-9]*/num-processors 1/"	\
		   gimprc.tmp > gimprc.tmp2				\
		&& (cmp -s gimprc.tmp2 $(top_srcdir)/docs/gimprc.5.in ||\
		    cp gimprc.tmp2 $(top_srcdir)/docs/gimprc.5.in)	\
		&& rm gimprc.tmp gimprc.tmp2
262 263

dist-hook: dist-check-gimp-console dist-dump-gimprc
264

265
# If git is available, always check if git-version.h should be
Mukund Sivaraman's avatar
Mukund Sivaraman committed
266
# updated. If git is not available, don't do anything if git-version.h
267 268 269 270
# already exists because then we are probably working with a tarball
# in which case the git-version.h we ship is correct.
git-version.h: update-git-version-header
	@if test -d "$(top_srcdir)/.git"; then \
271
	  git_version="`git --git-dir=$(top_srcdir)/.git describe --always`"; \
272
	  git_last_commit_year="`git --git-dir=$(top_srcdir)/.git log -n1 --reverse --pretty=%ci | cut -b 1-4`"; \
273
	elif test ! -f "$@"; then \
274 275
	  git_version="Unknown, shouldn't happen"; \
	  git_last_commit_timestamp=-1; \
276
	  git_last_commit_year="`date -u '+%Y'`"; \
277
	fi; \
278 279 280 281 282 283 284
	if test -n "$$git_version"; then \
	  echo "#ifndef __GIT_VERSION_H__" > "$@.tmp"; \
	  echo "#define __GIT_VERSION_H__" >> "$@.tmp"; \
	  echo "#define GIMP_GIT_VERSION \"$$git_version\"" >> "$@.tmp"; \
	  echo "#define GIMP_GIT_LAST_COMMIT_YEAR \"$$git_last_commit_year\"" >> "$@.tmp"; \
	  echo "#endif /* __GIT_VERSION_H__ */" >> "$@.tmp"; \
	fi
285
	@if ( test -f "$@.tmp" && test -f "$@" && cmp "$@.tmp" "$@" > /dev/null ); then \
286 287 288
	  rm -f "$@.tmp"; \
	elif test -f "$@.tmp"; then \
	  mv "$@.tmp" "$@"; \
289
	  echo "  git HEAD changed: $@ regenerated"; \
290 291 292
	fi

.PHONY: update-git-version-header