1#  Copyright 2005 Adam Jackson.
2#
3#  Permission is hereby granted, free of charge, to any person obtaining a
4#  copy of this software and associated documentation files (the "Software"),
5#  to deal in the Software without restriction, including without limitation
6#  on the rights to use, copy, modify, merge, publish, distribute, sub
7#  license, and/or sell copies of the Software, and to permit persons to whom
8#  the Software is furnished to do so, subject to the following conditions:
9#
10#  The above copyright notice and this permission notice (including the next
11#  paragraph) shall be included in all copies or substantial portions of the
12#  Software.
13#
14#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16#  FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.  IN NO EVENT SHALL
17#  ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
18#  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19#  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21# this is obnoxious:
22# -module lets us name the module exactly how we want
23# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
24# _ladir passes a dummy rpath to libtool so the thing will actually link
25# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
26
27SUBDIRS = xvmc
28
29BUILT_SOURCES = version.h
30EXTRA_DIST = version.h
31CONFIG_CLEAN_FILES= version.h
32AM_CFLAGS = @XORG_CFLAGS@ @LIBUDEV_CFLAGS@ @DRI_CFLAGS@
33openchrome_drv_la_LTLIBRARIES = openchrome_drv.la
34openchrome_drv_la_LDFLAGS = -module -avoid-version @LIBUDEV_LIBS@
35openchrome_drv_ladir = @moduledir@/drivers
36
37openchrome_drv_la_SOURCES = \
38         compat-api.h \
39         via_eng_regs.h \
40         via_3d.c \
41         via_3d.h \
42         via_3d_reg.h \
43         via_analog.c \
44         via_rop.h \
45         via_exa.c \
46         via_exa_h2.c \
47         via_exa_h6.c \
48         via_ums.h \
49         via_ch7xxx.c \
50         via_ch7xxx.h \
51         via_display.c \
52         via_dmabuffer.h \
53         via_driver.c \
54         via_driver.h \
55         via_i2c.c \
56         via_id.c \
57         via_fp.c \
58         via_memcpy.c \
59         via_memmgr.h \
60         via_memmgr.c \
61         via_outputs.c \
62         via_mode.h \
63         via_priv.h \
64         via_regs.h \
65         via_sii164.c \
66         via_sii164.h \
67         via_tmds.c \
68         via_tv.c \
69         via_xv_overlay.c \
70         via_xv_overlay.h \
71         via_ums.c \
72         via_vgahw.c \
73         via_vgahw.h \
74         via_xv.c \
75         via_xv.h \
76         via_vt162x.c \
77         via_vt162x.h \
78         via_vt1632.c \
79         via_vt1632.h \
80         via_xvpriv.h
81
82if DRI
83openchrome_drv_la_SOURCES += \
84         via_dri.c \
85         via_dri.h \
86         via_drm.h \
87         via_drmclient.h \
88         via_kms.h \
89         via_kms.c \
90         via_xvmc.c \
91         via_xvmc.h \
92         drm_fourcc.h
93else
94EXTRA_DIST += \
95         via_dri.c \
96         via_dri.h \
97         via_drm.h \
98         via_drmclient.h \
99         via_kms.h \
100         via_kms.c \
101         via_xvmc.c \
102         via_xvmc.h \
103         drm_fourcc.h
104endif
105
106via_driver.lo: version.h
107version.h: $(openchrome_drv_la_SOURCES)
108	@if [ -d ../.git ]; then \
109        echo '#define BUILDCOMMENT "(development build, branch' \
110                     "`git branch -v | sed 's/no branch/no_branch/' | \
111                      awk '/^\*/ { print $$2 }'`" \
112                     'at revision' \
113                     "`git log -1 --pretty=format:%h | head -1`"')"' \
114                    > $@.tmp; \
115    else \
116        if [ -d .svn ]; then \
117	        echo '#define BUILDCOMMENT "(development build, at revision '\
118	                "`svnversion -nc .. | sed -e s/^[^:]*://`"')"' > $@.tmp; \
119        elif [ "$$SOURCE_DATE_EPOCH" ]; then \
120	        printf '#define BUILDCOMMENT "(compiled with SOURCE_DATE_EPOCH: %s)"' $$SOURCE_DATE_EPOCH \
121        	> $@.tmp; \
122        else \
123	        date +'#define BUILDCOMMENT "(development build, compiled on %c)"' \
124        	> $@.tmp; \
125	    fi; \
126    fi
127
128	@chmod 666 $@.tmp
129	@mv $@.tmp $@
130	@echo "created $@"
131
132dist-hook:
133	@[ -e version.h ] && rm version.h; \
134	echo '#define BUILDCOMMENT "(openchrome '$(VERSION)' release)"' \
135	> version.h
136