Module: xenomai-2.6
Branch: master
Commit: 0562409def555b5c932fec4b5053c62571be9b28
URL:    
http://git.xenomai.org/?p=xenomai-2.6.git;a=commit;h=0562409def555b5c932fec4b5053c62571be9b28

Author: Gilles Chanteperdrix <gilles.chanteperd...@xenomai.org>
Date:   Sun Nov 18 15:36:48 2012 +0100

examples: fix compilation

---

 examples/common/Makefile               |    8 +++++---
 examples/native/Makefile               |   18 +++++++-----------
 examples/posix/Makefile                |   13 +++++++------
 examples/rtdm/driver-api/Makefile      |    9 ++++++---
 examples/rtdm/profiles/can/Makefile    |    9 ++++++---
 examples/rtdm/profiles/ipc/Makefile    |   12 ++++++------
 examples/rtdm/profiles/serial/Makefile |    9 ++++++---
 7 files changed, 43 insertions(+), 35 deletions(-)

diff --git a/examples/common/Makefile b/examples/common/Makefile
index 57756c5..88976db 100644
--- a/examples/common/Makefile
+++ b/examples/common/Makefile
@@ -34,7 +34,8 @@ CC=$(shell $(XENOCONFIG) --cc)
 
 CFLAGS=$(shell $(XENOCONFIG) --skin=posix --cflags) $(MY_CFLAGS)
 
-LDFLAGS=$(shell $(XENOCONFIG) --skin=posix --ldflags) $(MY_LDFLAGS) -O
+LDFLAGS=$(MY_LDFLAGS) -O
+LDLIBS=$(shell $(XENOCONFIG) --skin=posix --ldflags)
 
 # This includes the library path of given Xenomai into the binary to make live
 # easier for beginners if Xenomai's libs are not in any default search path.
@@ -60,9 +61,10 @@ OBJS     := ${patsubst %, %.o, $(MODULES)}
 CLEANMOD := ${patsubst %, .%*, $(MODULES)}
 PWD      := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
 
-PATCHLEVEL:=$(shell sed 's/^PATCHLEVEL = *\(.*\)/\1/;t;d' $(KSRC)/Makefile)
 ### Kernel 2.6 or 3.0
-ifneq ($(strip $(PATCHLEVEL)),4)
+PATCHLEVEL:=$(shell sed 's/PATCHLEVEL = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+VERSION:=$(shell sed 's/VERSION = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+ifneq ($(VERSION).$(PATCHLEVEL),2.4)
 
 obj-m        := $(OBJS)
 EXTRA_CFLAGS := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix 
$(ADD_CFLAGS)
diff --git a/examples/native/Makefile b/examples/native/Makefile
index 485b3fa..2662bc5 100644
--- a/examples/native/Makefile
+++ b/examples/native/Makefile
@@ -32,13 +32,14 @@ endif
 
 CC=$(shell $(XENOCONFIG) --cc)
 
-CFLAGS=$(shell $(XENOCONFIG) --skin=native --cflags) $(MY_CFLAGS)
+CPPFLAGS=$(shell $(XENOCONFIG) --skin=native --cflags) $(MY_CFLAGS)
 
-LDFLAGS=$(shell $(XENOCONFIG) --skin=native --ldflags) $(MY_LDFLAGS)
+LDFLAGS=$(MY_LDFLAGS)
+LDLIBS=$(shell $(XENOCONFIG) --skin=native --ldflags)
 
 # This includes the library path of given Xenomai into the binary to make live
 # easier for beginners if Xenomai's libs are not in any default search path.
-LDFLAGS+=-Xlinker -rpath -Xlinker $(shell $(XENOCONFIG) --libdir)
+LOADLIBES+=-Xlinker -rpath -Xlinker $(shell $(XENOCONFIG) --libdir)
 
 all:: $(APPLICATIONS)
 
@@ -50,12 +51,6 @@ endif
 
 
 
-###### SPECIAL TARGET RULES ######
-rtprint: rtprint.c
-       $(CC) $(CFLAGS) $? $(LDFLAGS) -o $@
-
-
-
 ###### KERNEL MODULE BUILD (no change required normally) ######
 ifneq ($(MODULES),)
 
@@ -66,9 +61,10 @@ OBJS     := ${patsubst %, %.o, $(MODULES)}
 CLEANMOD := ${patsubst %, .%*, $(MODULES)}
 PWD      := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
 
-PATCHLEVEL:=$(shell sed 's/^PATCHLEVEL = *\(.*\)/\1/;t;d' $(KSRC)/Makefile)
 ### Kernel 2.6 or 3.0
-ifneq ($(strip $(PATCHLEVEL)),4)
+PATCHLEVEL:=$(shell sed 's/PATCHLEVEL = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+VERSION:=$(shell sed 's/VERSION = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+ifneq ($(VERSION).$(PATCHLEVEL),2.4)
 
 obj-m        := $(OBJS)
 EXTRA_CFLAGS := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix 
$(ADD_CFLAGS)
diff --git a/examples/posix/Makefile b/examples/posix/Makefile
index a1ce80d..0ecf739 100644
--- a/examples/posix/Makefile
+++ b/examples/posix/Makefile
@@ -5,7 +5,6 @@ APPLICATIONS = satch
 
 ### Note: to override the search path for the xeno-config script, use "make 
XENO=..."
 
-
 ### List of modules to be build
 MODULES = satch
 
@@ -15,7 +14,6 @@ all::
 
 satch: satch.c
 
-
 ###### USER SPACE BUILD (no change required normally) ######
 ifeq ($(KERNELRELEASE),)
 ifneq ($(APPLICATIONS),)
@@ -35,9 +33,10 @@ endif
 
 CC=$(shell $(XENOCONFIG) --cc)
 
-CFLAGS=-DCONSUMER $(shell $(XENOCONFIG) --skin=posix --cflags) $(APP_CFLAGS)
+CFLAGS=-DCONSUMER $(shell $(XENOCONFIG) --skin=posix --cflags) $(MY_CFLAGS)
 
-LDFLAGS=$(shell $(XENOCONFIG) --skin=posix --ldflags) $(APP_LDFLAGS)
+LDFLAGS=$(MY_LDFLAGS)
+LDLIBS=$(shell $(XENOCONFIG) --skin=posix --ldflags)
 
 # This includes the library path of given Xenomai into the binary to make live
 # easier for beginners if Xenomai's libs are not in any default search path.
@@ -55,7 +54,6 @@ endif
 
 ###### KERNEL MODULE BUILD (no change required normally) ######
 ifneq ($(MODULES),)
-
 ### Default to sources of currently running kernel
 KSRC ?= /lib/modules/$(shell uname -r)/build
 
@@ -65,12 +63,14 @@ PWD      := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; 
else pwd; fi)
 
 ### Kernel 2.6 or 3.0
 PATCHLEVEL:=$(shell sed 's/PATCHLEVEL = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
-ifneq ($(PATCHLEVEL),4)
+VERSION:=$(shell sed 's/VERSION = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+ifneq ($(VERSION).$(PATCHLEVEL),2.4)
 
 obj-m        := $(OBJS)
 EXTRA_CFLAGS := -DPRODUCER -I$(KSRC)/include/xenomai 
-I$(KSRC)/include/xenomai/posix $(ADD_CFLAGS)
 
 all::
+       echo $(MAKE) -C $(KSRC) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) 
SUBDIRS=$(PWD) modules
        $(MAKE) -C $(KSRC) ARCH=$(ARCH) CROSS_COMPILE=$(CROSS_COMPILE) 
SUBDIRS=$(PWD) modules
        $(RM) *.o
 
@@ -82,6 +82,7 @@ INCLUDE := -I$(KSRC)/include/xenomai 
-I$(KSRC)/include/xenomai/compat -I$(KSRC)/
 CFLAGS  += $(shell $(MAKE) -s -C $(KSRC) CC=$(CC) ARCH=$(ARCH) SUBDIRS=$(PWD) 
modules) $(INCLUDE)
 
 all:: $(OBJS)
+       /bin/false
 
 endif
 
diff --git a/examples/rtdm/driver-api/Makefile 
b/examples/rtdm/driver-api/Makefile
index 255c3d5..5461709 100644
--- a/examples/rtdm/driver-api/Makefile
+++ b/examples/rtdm/driver-api/Makefile
@@ -34,7 +34,9 @@ CC=$(shell $(XENOCONFIG) --cc)
 
 CFLAGS=$(shell $(XENOCONFIG) --skin=native --cflags) $(MY_CFLAGS)
 
-LDFLAGS=$(shell $(XENOCONFIG) --skin=native --ldflags) $(MY_LDFLAGS) -lrtdm
+LDFLAGS=$(MY_LDFLAGS)
+LDLIBS=$(shell $(XENOCONFIG) --skin=native --ldflags) \
+       $(shell $(XENOCONFIG) --skin=rtdm --ldflags)
 
 # This includes the library path of given Xenomai into the binary to make live
 # easier for beginners if Xenomai's libs are not in any default search path.
@@ -60,9 +62,10 @@ OBJS     := ${patsubst %, %.o, $(MODULES)}
 CLEANMOD := ${patsubst %, .%*, $(MODULES)}
 PWD      := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
 
-PATCHLEVEL:=$(shell sed 's/^PATCHLEVEL = *\(.*\)/\1/;t;d' $(KSRC)/Makefile)
 ### Kernel 2.6 or 3.0
-ifneq ($(strip $(PATCHLEVEL)),4)
+PATCHLEVEL:=$(shell sed 's/PATCHLEVEL = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+VERSION:=$(shell sed 's/VERSION = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+ifneq ($(VERSION).$(PATCHLEVEL),2.4)
 
 obj-m        := $(OBJS)
 EXTRA_CFLAGS := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix 
$(ADD_CFLAGS)
diff --git a/examples/rtdm/profiles/can/Makefile 
b/examples/rtdm/profiles/can/Makefile
index 25be6b8..9ea5d35 100644
--- a/examples/rtdm/profiles/can/Makefile
+++ b/examples/rtdm/profiles/can/Makefile
@@ -34,7 +34,9 @@ CC=$(shell $(XENOCONFIG) --cc)
 
 CFLAGS=$(shell $(XENOCONFIG) --skin=posix --cflags) $(MY_CFLAGS)
 
-LDFLAGS=$(shell $(XENOCONFIG) --skin=posix --ldflags) $(MY_LDFLAGS) -lrtdm
+LDFLAGS=$(MY_LDFLAGS)
+LDLIBS=$(shell $(XENOCONFIG) --skin=posix --ldflags) \
+       $(shell $(XENOCONFIG) --skin=rtdm --ldflags)
 
 # This includes the library path of given Xenomai into the binary to make live
 # easier for beginners if Xenomai's libs are not in any default search path.
@@ -60,9 +62,10 @@ OBJS     := ${patsubst %, %.o, $(MODULES)}
 CLEANMOD := ${patsubst %, .%*, $(MODULES)}
 PWD      := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
 
-PATCHLEVEL:=$(shell sed 's/^PATCHLEVEL = *\(.*\)/\1/;t;d' $(KSRC)/Makefile)
 ### Kernel 2.6 or 3.0
-ifneq ($(strip $(PATCHLEVEL)),4)
+PATCHLEVEL:=$(shell sed 's/PATCHLEVEL = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+VERSION:=$(shell sed 's/VERSION = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+ifneq ($(VERSION).$(PATCHLEVEL),2.4)
 
 obj-m        := $(OBJS)
 EXTRA_CFLAGS := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix 
$(ADD_CFLAGS)
diff --git a/examples/rtdm/profiles/ipc/Makefile 
b/examples/rtdm/profiles/ipc/Makefile
index 4ea38f0..ca26750 100644
--- a/examples/rtdm/profiles/ipc/Makefile
+++ b/examples/rtdm/profiles/ipc/Makefile
@@ -37,10 +37,9 @@ CC=$(shell $(XENOCONFIG) --cc)
 
 CFLAGS=$(shell $(XENOCONFIG) --skin=posix --cflags) $(MY_CFLAGS)
 
-LDFLAGS=$(shell $(XENOCONFIG) --skin=posix --ldflags) $(MY_LDFLAGS) -lrtdm
-
-%: %.c
-       $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
+LDFLAGS=$(MY_LDFLAGS)
+LDLIBS=$(shell $(XENOCONFIG) --skin=posix --ldflags) \
+       $(shell $(XENOCONFIG) --skin=rtdm --ldflags)
 
 # Add the Xenomai libdir to the runtime library search path for the
 # binary, to make life easier for beginners if Xenomai's libs are not
@@ -67,9 +66,10 @@ OBJS     := ${patsubst %, %.o, $(MODULES)}
 CLEANMOD := ${patsubst %, .%*, $(MODULES)}
 PWD      := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
 
-PATCHLEVEL:=$(shell sed 's/^PATCHLEVEL = *\(.*\)/\1/;t;d' $(KSRC)/Makefile)
 ### Kernel 2.6 or 3.0
-ifneq ($(strip $(PATCHLEVEL)),4)
+PATCHLEVEL:=$(shell sed 's/PATCHLEVEL = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+VERSION:=$(shell sed 's/VERSION = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+ifneq ($(VERSION).$(PATCHLEVEL),2.4)
 
 obj-m        := $(OBJS)
 EXTRA_CFLAGS := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix 
$(ADD_CFLAGS)
diff --git a/examples/rtdm/profiles/serial/Makefile 
b/examples/rtdm/profiles/serial/Makefile
index 3b2aaab..89632ae 100644
--- a/examples/rtdm/profiles/serial/Makefile
+++ b/examples/rtdm/profiles/serial/Makefile
@@ -34,7 +34,9 @@ CC=$(shell $(XENOCONFIG) --cc)
 
 CFLAGS=$(shell $(XENOCONFIG) --skin=native --cflags) $(MY_CFLAGS)
 
-LDFLAGS=$(shell $(XENOCONFIG) --skin=native --ldflags) $(MY_LDFLAGS) -lrtdm
+LDFLAGS=$(MY_LDFLAGS)
+LDLIBS=$(shell $(XENOCONFIG) --skin=native --ldflags) \
+       $(shell $(XENOCONFIG) --skin=rtdm --ldflags)
 
 # This includes the library path of given Xenomai into the binary to make live
 # easier for beginners if Xenomai's libs are not in any default search path.
@@ -60,9 +62,10 @@ OBJS     := ${patsubst %, %.o, $(MODULES)}
 CLEANMOD := ${patsubst %, .%*, $(MODULES)}
 PWD      := $(shell if [ "$$PWD" != "" ]; then echo $$PWD; else pwd; fi)
 
-PATCHLEVEL:=$(shell sed 's/^PATCHLEVEL = *\(.*\)/\1/;t;d' $(KSRC)/Makefile)
 ### Kernel 2.6 or 3.0
-ifneq ($(strip $(PATCHLEVEL)),4)
+PATCHLEVEL:=$(shell sed 's/PATCHLEVEL = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+VERSION:=$(shell sed 's/VERSION = \(.*\)/\1/;t;d' $(KSRC)/Makefile)
+ifneq ($(VERSION).$(PATCHLEVEL),2.4)
 
 obj-m        := $(OBJS)
 EXTRA_CFLAGS := -I$(KSRC)/include/xenomai -I$(KSRC)/include/xenomai/posix 
$(ADD_CFLAGS)


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to