Makefile.am 7.76 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 71 72
	about.h			\
	app.c			\
	app.h			\
	batch.c			\
	batch.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	\
73
	gimp-intl.h
74

75 76 77
libapp_generated_sources = \
	git-version.h

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

82 83
CLEANFILES = $(libapp_generated_sources)

84 85 86
$(srcdir)/version.c: git-version.h

libapp_a_SOURCES = $(libapp_sources) $(libapp_generated_sources)
87

88
gimp_@GIMP_APP_VERSION@_SOURCES = $(libapp_sources) main.c
89

90

91
if PLATFORM_OSX
92
framework_cocoa = -framework Cocoa
93 94
endif

95
if OS_WIN32
96
win32_ldflags = -mwindows -Wl,--tsaware $(WIN32_LARGE_ADDRESS_AWARE)
97 98
else
libm = -lm
99
endif
100

101
if USE_BINRELOC
102 103
munix = -Wl,-rpath '-Wl,$$ORIGIN/../lib'
endif
104

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

111
AM_CPPFLAGS = \
112
	-DG_LOG_DOMAIN=\"Gimp\"		\
113 114 115 116 117
	-DGIMP_APP_GLUE_COMPILATION	\
	-I$(top_srcdir)			\
	$(GTK_CFLAGS)			\
	$(PANGOCAIRO_CFLAGS)		\
	$(GEGL_CFLAGS)			\
118
	$(GEXIV2_CFLAGS)		\
119
	-I$(includedir)			\
120
	-I$(builddir)/gui
Elliot Lee's avatar
Elliot Lee committed
121

122 123
# FIXME: core should not depend on xcf
workaround_that_core_depends_on_xcf = \
124
	-Wl,-u,$(SYMPREFIX)xcf_init
125 126 127

# FIXME: core should not depend on pdb
workaround_that_core_depends_on_pdb = \
128 129
	-Wl,-u,$(SYMPREFIX)internal_procs_init		\
	-Wl,-u,$(SYMPREFIX)gimp_plug_in_manager_restore
130

131 132
# FIXME: plug-in should not depend on pdb
workaround_that_plug_in_depends_on_pdb = \
133
	-Wl,-u,$(SYMPREFIX)gimp_pdb_compat_param_spec
134

135 136 137
# core, vectors and gegl are on the same architectural layer, prevent
# the linker from panicing
calm_down_linker = \
138 139 140 141 142
	-Wl,-u,$(SYMPREFIX)gimp_vectors_undo_get_type		\
	-Wl,-u,$(SYMPREFIX)gimp_vectors_mod_undo_get_type	\
	-Wl,-u,$(SYMPREFIX)gimp_vectors_prop_undo_get_type	\
	-Wl,-u,$(SYMPREFIX)gimp_curve_map_pixels		\
	-Wl,-u,$(SYMPREFIX)gimp_param_spec_duplicate		\
143
	-Wl,-u,$(SYMPREFIX)gimp_operations_init
144 145 146 147 148 149

AM_LDFLAGS = \
	$(munix)					\
	$(calm_down_linker)				\
	$(workaround_that_core_depends_on_xcf)		\
	$(workaround_that_core_depends_on_pdb)		\
150
	$(workaround_that_plug_in_depends_on_pdb)
151 152

gimpconsoleldadd = \
153
	xcf/libappxcf.a			\
154
	pdb/libappinternal-procs.a	\
155
	pdb/libapppdb.a			\
156
	plug-in/libappplug-in.a		\
157
	vectors/libappvectors.a		\
158 159
	core/libappcore.a		\
	file/libappfile.a		\
160
	text/libapptext.a		\
161
	paint/libapppaint.a		\
162
	operations/libappoperations.a	\
Michael Natterer's avatar
Michael Natterer committed
163
	gegl/libappgegl.a		\
164
	config/libappconfig.a		\
165
	$(libgimpconfig)		\
166 167 168 169
	$(libgimpmath)			\
	$(libgimpthumb)			\
	$(libgimpcolor)			\
	$(libgimpmodule)		\
170
	$(libgimpbase)			\
171
	$(GDK_PIXBUF_LIBS)		\
172
	$(FREETYPE_LIBS)		\
173 174
	$(FONTCONFIG_LIBS)		\
	$(PANGOCAIRO_LIBS)		\
175
	$(HARFBUZZ_LIBS)		\
176
	$(CAIRO_LIBS)			\
177 178
	$(GIO_UNIX_LIBS)		\
	$(GIO_WINDOWS_LIBS)		\
179
	$(GEGL_LIBS)			\
180
	$(GLIB_LIBS)			\
181
	$(GEXIV2_LIBS)			\
182
	$(LCMS_LIBS)			\
183
	$(Z_LIBS)			\
184
	$(JSON_C_LIBS)			\
185
	$(LIBMYPAINTGEGL_LIBS)		\
186
	$(INTLLIBS)			\
187 188
	$(RT_LIBS)			\
	$(libm)
189

190 191 192
gimp_@GIMP_APP_VERSION@_LDFLAGS = \
	$(AM_LDFLAGS)		\
	$(win32_ldflags)	\
193
	$(framework_cocoa)	\
194
	-Wl,-u,$(SYMPREFIX)gimp_lebl_dialog
195

196
gimp_@GIMP_APP_VERSION@_LDADD = \
197 198 199 200 201 202 203 204 205 206 207 208
	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)		\
209
	$(GIMPRC)
210

211

212
if ENABLE_GIMP_CONSOLE
213

214
gimp_console_@GIMP_APP_VERSION@_SOURCES = $(libapp_sources) main.c
215

216
gimp_console_@GIMP_APP_VERSION@_CPPFLAGS = \
217 218 219
	$(AM_CPPFLAGS)			\
	-DGIMP_CONSOLE_COMPILATION

220
gimp_console_@GIMP_APP_VERSION@_LDADD = \
221 222
	$(gimpconsoleldadd) \
	$(GIMPCONSOLERC)
223

224 225
endif

226

227 228 229
install-exec-hook:
if DEFAULT_BINARY
	cd $(DESTDIR)$(bindir) \
230
	&& rm -f gimp$(EXEEXT) \
231
	&& $(LN_S) gimp-$(GIMP_APP_VERSION)$(EXEEXT) gimp$(EXEEXT)
232 233 234
if ENABLE_GIMP_CONSOLE
	cd $(DESTDIR)$(bindir) \
	&& rm -f gimp-console$(EXEEXT) \
235
	&& $(LN_S) gimp-console-$(GIMP_APP_VERSION)$(EXEEXT) gimp-console$(EXEEXT)
236
endif
237 238 239 240
endif

uninstall-local:
if DEFAULT_BINARY
241
	rm -f $(DESTDIR)$(bindir)/gimp$(EXEEXT)
242
if ENABLE_GIMP_CONSOLE
243
	rm -f $(DESTDIR)$(bindir)/gimp-console$(EXEEXT)
244
endif
245
endif
246 247


248 249 250 251 252 253 254 255 256
# 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
257

258 259 260 261 262

# 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)
263
	./$< --dump-gimprc-system > gimprc.tmp	\
264 265 266 267 268
		&& 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
269
	./$< --dump-gimprc-manpage > gimprc.tmp	\
270 271 272 273 274
		&& 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
275 276

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

278
# If git is available, always check if git-version.h should be
Mukund Sivaraman's avatar
Mukund Sivaraman committed
279
# updated. If git is not available, don't do anything if git-version.h
280 281 282 283
# 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 \
284
	  git_version="`git --git-dir=$(top_srcdir)/.git describe --always`"; \
285
	  git_last_commit_year="`git --git-dir=$(top_srcdir)/.git log -n1 --reverse --pretty=%ci | cut -b 1-4`"; \
286
	elif test ! -f "$@"; then \
287 288
	  git_version="Unknown, shouldn't happen"; \
	  git_last_commit_timestamp=-1; \
289
	  git_last_commit_year="`date -u '+%Y'`"; \
290
	fi; \
291 292 293 294 295 296 297
	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
298
	@if ( test -f "$@.tmp" && test -f "$@" && cmp "$@.tmp" "$@" > /dev/null ); then \
299 300 301
	  rm -f "$@.tmp"; \
	elif test -f "$@.tmp"; then \
	  mv "$@.tmp" "$@"; \
302
	  echo "  git HEAD changed: $@ regenerated"; \
303 304 305
	fi

.PHONY: update-git-version-header