summaryrefslogtreecommitdiff
path: root/Makefile.am
blob: 8ce135604b207838258cf01cac2346af61523190 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
NULL =
EXTRA_DIST = mingw-spice-vdagent.spec
MAINTAINERCLEANFILES = mingw-spice-vdagent.spec

AM_CPPFLAGS = 				\
	-DUNICODE 			\
	-D_UNICODE			\
	-DOLDMSVCRT			\
	-DWINVER=0x0601			\
	-I$(top_srcdir)/common		\
	-I$(top_srcdir)/spice-protocol	\
	-I$(top_srcdir)/spice-common	\
	$(NULL)

AM_LDFLAGS = -static
if !ENABLE_DEBUG
AM_LDFLAGS += -s
endif

# binutils does not take into account entry point when
# -pie is used so we need to provide it manually
# ENTRY_PREFIX is empty for x86_64, underscore ("_") otherwise
ENTRY_PREFIX := $(if $(filter x86_64,$(host_cpu)),,_)

# --dynamicbase to enable ASLR protection
# --nxcompat is to enable NX protection
# -pie as --dynamicbase requires relocations
LDFLAGS_SECURITY_COMMON = \
	-Wl,--dynamicbase -Wl,-pie \
	-Wl,--nxcompat \
	$(NULL)
LDFLAGS_SECURITY_GUI = $(LDFLAGS_SECURITY_COMMON) \
	-Wl,-e,$(ENTRY_PREFIX)WinMainCRTStartup \
	-mwindows \
	$(NULL)
LDFLAGS_SECURITY_CUI = $(LDFLAGS_SECURITY_COMMON) \
	-Wl,-e,$(ENTRY_PREFIX)mainCRTStartup \
	-mconsole \
	$(NULL)

bin_PROGRAMS = vdagent vdservice

vdagent_LDADD = $(LIBPNG_LIBS) $(ZLIB_LIBS) -lwtsapi32 -lgdi32 -luuid -lole32 -loleaut32 -lmpr -lshlwapi vdagent_rc.$(OBJEXT)
vdagent_CXXFLAGS = $(AM_CXXFLAGS) $(LIBPNG_CFLAGS)
vdagent_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_SECURITY_GUI)
vdagent_SOURCES =			\
	common/vdcommon.cpp             \
	common/vdcommon.h		\
	common/vdlog.cpp		\
	common/vdlog.h			\
	spice-common/common/agent.c	\
	spice-common/common/agent.h	\
	vdagent/display_configuration.cpp \
	vdagent/display_configuration.h \
	vdagent/desktop_layout.cpp	\
	vdagent/desktop_layout.h	\
	vdagent/display_setting.cpp	\
	vdagent/display_setting.h	\
	vdagent/file_xfer.cpp		\
	vdagent/file_xfer.h		\
	vdagent/vdagent.cpp		\
	vdagent/as_user.cpp		\
	vdagent/as_user.h		\
	vdagent/image.cpp		\
	vdagent/image.h			\
	vdagent/imagepng.cpp		\
	vdagent/imagepng.h		\
	vdagent/shell.cpp		\
	vdagent/shell.h			\
	$(NULL)

vdagent_rc.$(OBJEXT): vdagent/vdagent.rc
	$(AM_V_GEN)$(WINDRES) -I $(top_builddir) -i $< -o $@

MAINTAINERCLEANFILES += vdagent_rc.$(OBJEXT)

vdservice_LDADD = -lwtsapi32 vdservice_rc.$(OBJEXT)
vdservice_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_SECURITY_CUI)
vdservice_SOURCES =			\
	common/stdint.h			\
	common/vdcommon.cpp             \
	common/vdcommon.h		\
	common/vdlog.cpp		\
	common/vdlog.h			\
	vdservice/vdservice.cpp		\
	$(NULL)

vdservice_rc.$(OBJEXT): vdservice/vdservice.rc
	$(AM_V_GEN)$(WINDRES) -I $(top_builddir) -i $< -o $@

MAINTAINERCLEANFILES += vdservice_rc.$(OBJEXT)

check_PROGRAMS = imagetest

imagetest_LDADD = $(LIBPNG_LIBS) $(ZLIB_LIBS) -lwtsapi32 -lgdi32
imagetest_CXXFLAGS = $(AM_CXXFLAGS) $(LIBPNG_CFLAGS)
imagetest_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_SECURITY_CUI)
imagetest_SOURCES =			\
	common/vdcommon.cpp             \
	common/vdcommon.h		\
	common/vdlog.cpp		\
	common/vdlog.h			\
	vdagent/imagetest.cpp		\
	vdagent/image.cpp		\
	vdagent/image.h			\
	vdagent/imagepng.cpp		\
	vdagent/imagepng.h		\
	$(NULL)

TESTS = test-png
EXTRA_DIST += test-png

check_PROGRAMS += test-log-win
TESTS += test-log
EXTRA_DIST += test-log

test_log_win_LDFLAGS = $(AM_LDFLAGS) $(LDFLAGS_SECURITY_CUI)
test_log_win_SOURCES =			\
	common/vdcommon.cpp             \
	common/vdcommon.h		\
	common/vdlog.cpp		\
	common/vdlog.h			\
	common/test-log.cpp		\
	$(NULL)

check_PROGRAMS += test-shell-win
TESTS += test-shell
EXTRA_DIST += test-shell
test_shell_win_LDFLAGS = $(AM_LDFLAGS) -Wl,--subsystem,console
test_shell_win_LDADD = -luuid -lole32 -loleaut32
test_shell_win_SOURCES = \
	vdagent/test-shell.cpp \
	$(NULL)

MANUFACTURER = The Spice Project
PRODUCT = Spice agent

EXTRA_DIST += spice-vdagent.wxs.in
CONFIG_STATUS_DEPENDENCIES = spice-vdagent.wxs.in

spice-vdagent-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi: spice-vdagent.wxs all
	$(AM_V_GEN)DESTDIR=`mktemp -d`&&				\
	make -C $(top_builddir) install DESTDIR=$$DESTDIR >/dev/null &&	\
	  MANUFACTURER="$(MANUFACTURER)" PRODUCT="$(PRODUCT)"           \
	  INSTALLDIRECTORY="$(PRODUCT)" BINDIRECTORY=bin                \
	  wixl -D SourceDir=$$DESTDIR$(prefix)/bin                      \
	  --arch $(WIXL_ARCH)  -o $@ $<

msi: spice-vdagent-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi

CLEANFILES = spice-vdagent-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi

.PHONY: msi

EXTRA_DIST +=			\
	$(top_srcdir)/.version	\
	config.h		\
	common/version.rc	\
	tests/clipboard.py	\
	vdagent/resource.h	\
	vdagent/vdagent.rc	\
	vdservice/resource.h	\
	vdservice/vdservice.rc	\
	CMakeLists.txt

## spice-protocol moved to Meson, distribute manually
EXTRA_DIST +=					\
	spice-protocol/spice/barrier.h		\
	spice-protocol/spice/end-packed.h	\
	spice-protocol/spice/enums.h		\
	spice-protocol/spice/ipc_ring.h		\
	spice-protocol/spice/macros.h		\
	spice-protocol/spice/qxl_dev.h		\
	spice-protocol/spice/qxl_windows.h	\
	spice-protocol/spice/start-packed.h	\
	spice-protocol/spice/types.h		\
	spice-protocol/spice/vd_agent.h		\
	$(NULL)

# see git-version-gen
dist-hook:
	echo $(VERSION) > $(distdir)/.tarball-version

BUILT_SOURCES = $(top_srcdir)/.version
$(top_srcdir)/.version:
	echo $(VERSION) > $@-t && mv $@-t $@

MAINTAINERCLEANFILES += $(GITIGNORE_MAINTAINERCLEANFILES_TOPLEVEL)

-include $(top_srcdir)/git.mk