summaryrefslogtreecommitdiff
path: root/package/xenomai/xenomai.mk
blob: 52e0b4e54aee684b86f50caebebcb88836eb8499 (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
#############################################################
# Xenomai
# URL  : http://xenomai.org
# NOTE : Real-Time Framework for Linux
#
#############################################################

XENOMAI_VERSION = $(call qstrip,$(BR2_PACKAGE_XENOMAI_VERSION))
ifeq ($(XENOMAI_VERSION),)
XENOMAI_VERSION = 2.5.6
endif

XENOMAI_SITE = http://download.gna.org/xenomai/stable/
XENOMAI_SOURCE = xenomai-$(XENOMAI_VERSION).tar.bz2

XENOMAI_INSTALL_STAGING = YES

ifeq ($(BR2_arm),y)
XENOMAI_CPU_TYPE = $(call qstrip,$(BR2_PACKAGE_XENOMAI_CPU_TYPE))
# Set "generic" if not defined
ifeq ($(XENOMAI_CPU_TYPE),)
XENOMAI_CPU_TYPE = generic
endif
XENOMAI_CONF_OPT += --enable-arm-mach=$(XENOMAI_CPU_TYPE)
endif #BR2_arm

ifeq ($(BR2_PACKAGE_XENOMAI_SMP),y)
XENOMAI_CONF_OPT += --enable-smp
endif

# The configure step needs to be overloaded, because Xenomai doesn't
# support --prefix=/usr and the autotargets infrastructure enforces
# this.
define XENOMAI_CONFIGURE_CMDS
	(cd $(@D); rm -rf config.cache; \
		$(TARGET_CONFIGURE_OPTS) \
		$(TARGET_CONFIGURE_ARGS) \
		CCFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \
		./configure \
		$(XENOMAI_CONF_OPT) \
		--host=$(GNU_TARGET_NAME) \
	)
endef

ifeq ($(BR2_HAVE_DOCUMENTATION),)
define XENOMAI_REMOVE_DOCUMENTATION
	rm -rf $(TARGET_DIR)/usr/xenomai/share/doc
	rm -rf $(TARGET_DIR)/usr/xenomai/share/man
endef

XENOMAI_POST_INSTALL_TARGET_HOOKS += XENOMAI_REMOVE_DOCUMENTATION
endif

ifeq ($(BR2_HAVE_DEVFILES),)
define XENOMAI_REMOVE_DEVFILES
	rm -rf $(TARGET_DIR)/usr/xenomai/include
	for i in xeno-config xeno-info wrap-link.sh ; do \
		rm -f $(TARGET_DIR)/usr/xenomai/bin/$$i ; \
	done
endef

XENOMAI_POST_INSTALL_TARGET_HOOKS += XENOMAI_REMOVE_DEVFILES
endif

ifeq ($(BR2_PACKAGE_XENOMAI_TESTSUITE),)
define XENOMAI_REMOVE_TESTSUITE
	rm -rf $(TARGET_DIR)/usr/xenomai/share/xenomai/testsuite/
	rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/xenomai/share/xenomai/
	rmdir --ignore-fail-on-non-empty $(TARGET_DIR)/usr/xenomai/share/
	for i in klatency rtdm xeno xeno-load check-vdso \
		irqloop cond-torture-posix switchtest arith \
		sigtest clocktest cyclictest latency wakeup-time \
		xeno-test cond-torture-native mutex-torture-posix \
		mutex-torture-native ; do \
		rm -f $(TARGET_DIR)/usr/xenomai/bin/$$i ; \
	done
endef

XENOMAI_POST_INSTALL_TARGET_HOOKS += XENOMAI_REMOVE_TESTSUITE
endif

ifeq ($(BR2_PACKAGE_XENOMAI_RTCAN),)
define XENOMAI_REMOVE_RTCAN_PROGS
	for i in rtcanrecv rtcansend ; do \
		rm -f $(TARGET_DIR)/usr/xenomai/bin/$$i ; \
	done
	rm -f $(TARGET_DIR)/usr/xenomai/sbin/rtcanconfig
endef

XENOMAI_POST_INSTALL_TARGET_HOOKS += XENOMAI_REMOVE_RTCAN_PROGS
endif

ifeq ($(BR2_PACKAGE_XENOMAI_ANALOGY),)
define XENOMAI_REMOVE_ANALOGY
	for i in cmd_bits cmd_read cmd_write insn_write \
		insn_bits insn_read ; do \
		rm -f $(TARGET_DIR)/usr/xenomai/bin/$$i ; \
	done
	rm -f $(TARGET_DIR)/usr/xenomai/sbin/analogy_config
	rm -f $(TARGET_DIR)/usr/xenomai/lib/libanalogy.*
endef

XENOMAI_POST_INSTALL_TARGET_HOOKS += XENOMAI_REMOVE_ANALOGY
endif

XENOMAI_REMOVE_SKIN_LIST += $(if $(BR2_PACKAGE_XENOMAI_NATIVE_SKIN),,native)
XENOMAI_REMOVE_SKIN_LIST += $(if $(BR2_PACKAGE_XENOMAI_POSIX_SKIN),,posix)
XENOMAI_REMOVE_SKIN_LIST += $(if $(BR2_PACKAGE_XENOMAI_VXWORKS_SKIN),,vxworks)
XENOMAI_REMOVE_SKIN_LIST += $(if $(BR2_PACKAGE_XENOMAI_PSOS_SKIN),,psos)
XENOMAI_REMOVE_SKIN_LIST += $(if $(BR2_PACKAGE_XENOMAI_RTAI_SKIN),,rtai)
XENOMAI_REMOVE_SKIN_LIST += $(if $(BR2_PACKAGE_XENOMAI_UITRON_SKIN),,uitron)
XENOMAI_REMOVE_SKIN_LIST += $(if $(BR2_PACKAGE_XENOMAI_VRTX_SKIN),,vrtx)

define XENOMAI_REMOVE_SKINS
	for i in $(XENOMAI_REMOVE_SKIN_LIST) ; do \
		rm -f $(TARGET_DIR)/usr/xenomai/lib/lib$$i.* ; \
		if [ $$i == "posix" ] ; then \
			rm -f $(TARGET_DIR)/usr/xenomai/lib/posix.wrappers ; \
		fi ; \
	done
endef

XENOMAI_POST_INSTALL_TARGET_HOOKS += XENOMAI_REMOVE_SKINS

define XENOMAI_ADD_LD_SO_CONF
	# Add /usr/xenomai/lib in the library search path
	grep -q "^/usr/xenomai/lib" $(TARGET_DIR)/etc/ld.so.conf || \
		echo "/usr/xenomai/lib" >> $(TARGET_DIR)/etc/ld.so.conf
endef

XENOMAI_POST_INSTALL_TARGET_HOOKS += XENOMAI_ADD_LD_SO_CONF

# If you use static /dev creation don't forget to update your
#  device_table_dev.txt
ifeq ($(BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_UDEV),y)
XENOMAI_DEPENDENCIES += udev

define XENOMAI_INSTALL_UDEV_RULES
	if test -d $(TARGET_DIR)/etc/udev/rules.d ; then \
		for f in $(@D)/ksrc/nucleus/udev/*.rules ; do \
			cp $$f $(TARGET_DIR)/etc/udev/rules.d/ ; \
		done ; \
	fi;
endef

XENOMAI_POST_INSTALL_TARGET_HOOKS += XENOMAI_INSTALL_UDEV_RULES
endif # udev

define XENOMAI_REMOVE_UDEV_RULES
	if test -d $(TARGET_DIR)/etc/udev/rules.d ; then \
		for f in $(@D)/ksrc/nucleus/udev/*.rules ; do \
			rm -f $(TARGET_DIR)/etc/udev/rules.d/$$f ; \
		done ; \
	fi;
endef

XENOMAI_POST_UNINSTALL_TARGET_HOOKS += XENOMAI_REMOVE_UDEV_RULES

$(eval $(call AUTOTARGETS,package,xenomai))