1#
2# rdesktop: A Remote Desktop Protocol client
3# Makefile.in
4# Copyright (C) Matthew Chapman 1999-2005
5#
6
7prefix      = @prefix@
8exec_prefix = @exec_prefix@
9bindir      = @bindir@
10mandir      = @mandir@
11datadir     = @datadir@
12
13VERSION     = @PACKAGE_VERSION@
14KEYMAP_PATH = $(datadir)/rdesktop/keymaps/
15
16CC          = @CC@
17INSTALL     = @INSTALL@
18CFLAGS      = @CFLAGS@ @X_CFLAGS@ @DEFS@ -DKEYMAP_PATH=\"$(KEYMAP_PATH)\"
19LDFLAGS     = @LDFLAGS@ @LIBS@ @X_LIBS@ @X_EXTRA_LIBS@
20STRIP       = @STRIP@
21
22TARGETS     = rdesktop @RDP2VNCTARGET@
23VNCINC      = @VNCINC@
24LDVNC       = @LDVNC@
25VNCLINK     = @VNCLINK@
26SOUNDOBJ    = @SOUNDOBJ@
27
28RDPOBJ   = tcp.o iso.o mcs.o secure.o licence.o rdp.o orders.o bitmap.o cache.o rdp5.o channels.o rdpdr.o serial.o printer.o disk.o parallel.o printercache.o mppc.o pstcache.o lspci.o seamless.o
29X11OBJ   = rdesktop.o xwin.o xkeymap.o ewmhints.o xclip.o cliprdr.o
30VNCOBJ   = vnc/rdp2vnc.o vnc/vnc.o vnc/xkeymap.o vnc/x11stubs.o
31
32.PHONY: all
33all: $(TARGETS)
34
35rdesktop: $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ)
36	$(CC) $(CFLAGS) -o rdesktop $(X11OBJ) $(SOUNDOBJ) $(RDPOBJ) $(LDFLAGS) -lX11
37
38rdp2vnc: $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ)
39	$(VNCLINK) $(CFLAGS) -o rdp2vnc $(VNCOBJ) $(SOUNDOBJ) $(RDPOBJ) $(LDFLAGS) $(LDVNC)
40
41vnc/rdp2vnc.o: rdesktop.c
42	$(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/rdp2vnc.o -c rdesktop.c
43
44vnc/vnc.o: vnc/vnc.c
45	$(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/vnc.o -c vnc/vnc.c
46
47vnc/xkeymap.o: xkeymap.c
48	$(CC) $(CFLAGS) $(VNCINC) -DRDP2VNC -o vnc/xkeymap.o -c xkeymap.c
49
50vnc/x11stubs.o: vnc/x11stubs.c
51	$(CC) $(CFLAGS) $(VNCINC) -o vnc/x11stubs.o -c vnc/x11stubs.c
52
53.PHONY: install
54install: installbin installkeymaps installman
55
56.PHONY: installbin
57installbin: rdesktop
58	mkdir -p $(DESTDIR)$(bindir)
59	$(INSTALL) rdesktop $(DESTDIR)$(bindir)
60	$(STRIP) $(DESTDIR)$(bindir)/rdesktop
61	chmod 755 $(DESTDIR)$(bindir)/rdesktop
62
63.PHONY: installman
64installman: doc/rdesktop.1
65	mkdir -p $(DESTDIR)$(mandir)/man1
66	cp doc/rdesktop.1 $(DESTDIR)$(mandir)/man1
67	chmod 644 $(DESTDIR)$(mandir)/man1/rdesktop.1
68
69.PHONY: installkeymaps
70installkeymaps:
71	mkdir -p $(DESTDIR)$(KEYMAP_PATH)
72# Prevent copying the CVS directory
73	cp keymaps/?? keymaps/??-?? $(DESTDIR)$(KEYMAP_PATH)
74	cp keymaps/common $(DESTDIR)$(KEYMAP_PATH)
75	cp keymaps/modifiers $(DESTDIR)$(KEYMAP_PATH)
76	chmod 644 $(DESTDIR)$(KEYMAP_PATH)/*
77
78.PHONY: proto
79proto:
80	cat proto.head > proto.h
81	cproto -DMAKE_PROTO \
82	bitmap.c cache.c channels.c cliprdr.c disk.c mppc.c ewmhints.c	\
83	iso.c licence.c mcs.c orders.c parallel.c printer.c printercache.c \
84	pstcache.c rdesktop.c rdp5.c rdp.c rdpdr.c rdpsnd.c rdpsnd_oss.c \
85	secure.c serial.c tcp.c xclip.c xkeymap.c xwin.c lspci.c seamless.c >> proto.h
86	cat proto.tail >> proto.h
87
88.PHONY: clean
89clean:
90	rm -f *.o *~ vnc/*.o vnc/*~ rdesktop rdp2vnc
91
92.PHONY: distclean
93distclean: clean
94	rm -rf autom4te.cache config.log config.status Makefile
95
96.PHONY: dist
97dist: rdesktop-$(VERSION).tar.gz
98
99rdesktop-$(VERSION).tar.gz: Makefile configure
100	mkdir -p /tmp/rdesktop-make-dist-dir
101	ln -sf `pwd` /tmp/rdesktop-make-dist-dir/rdesktop-$(VERSION)
102	(cd /tmp/rdesktop-make-dist-dir; \
103	tar zcvf rdesktop-$(VERSION)/rdesktop-$(VERSION).tar.gz \
104	rdesktop-$(VERSION)/COPYING \
105	rdesktop-$(VERSION)/README \
106	rdesktop-$(VERSION)/configure \
107	rdesktop-$(VERSION)/configure.ac \
108	rdesktop-$(VERSION)/config.sub \
109	rdesktop-$(VERSION)/config.guess \
110	rdesktop-$(VERSION)/bootstrap \
111	rdesktop-$(VERSION)/install-sh \
112	rdesktop-$(VERSION)/Makefile.in \
113	rdesktop-$(VERSION)/rdesktop.spec \
114	rdesktop-$(VERSION)/*.c \
115	rdesktop-$(VERSION)/*.h \
116	rdesktop-$(VERSION)/proto.head \
117	rdesktop-$(VERSION)/proto.tail \
118	rdesktop-$(VERSION)/keymaps/?? \
119	rdesktop-$(VERSION)/keymaps/??-?? \
120	rdesktop-$(VERSION)/keymaps/common \
121	rdesktop-$(VERSION)/keymaps/modifiers \
122	rdesktop-$(VERSION)/keymaps/convert-map \
123	rdesktop-$(VERSION)/doc/HACKING \
124	rdesktop-$(VERSION)/doc/AUTHORS \
125	rdesktop-$(VERSION)/doc/TODO \
126	rdesktop-$(VERSION)/doc/ChangeLog \
127	rdesktop-$(VERSION)/doc/keymapping.txt \
128	rdesktop-$(VERSION)/doc/keymap-names.txt \
129	rdesktop-$(VERSION)/doc/ipv6.txt \
130	rdesktop-$(VERSION)/doc/licensing.txt \
131	rdesktop-$(VERSION)/doc/patches.txt \
132	rdesktop-$(VERSION)/doc/redirection.txt \
133	rdesktop-$(VERSION)/doc/rdesktop.1 )
134	rm -rf /tmp/rdesktop-make-dist-dir
135
136.PHONY: dist-noversion
137dist-noversion: rdesktop.tar.gz
138
139rdesktop.tar.gz: rdesktop-$(VERSION).tar.gz
140	mkdir -p /tmp/rdesktop-make-dist-dir
141	tar zxvf $< -C /tmp/rdesktop-make-dist-dir
142	mv /tmp/rdesktop-make-dist-dir/rdesktop-$(VERSION) /tmp/rdesktop-make-dist-dir/rdesktop
143	ls /tmp/rdesktop-make-dist-dir/rdesktop
144	tar zcvf $@ -C /tmp/rdesktop-make-dist-dir rdesktop
145	rm -rf /tmp/rdesktop-make-dist-dir
146
147Makefile: Makefile.in configure
148	./config.status
149
150configure: configure.ac
151	./bootstrap
152
153.SUFFIXES:
154.SUFFIXES: .c .o
155
156.c.o:
157	$(CC) $(CFLAGS) -o $@ -c $<
158
159