[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[MiNT] [PATCH] Build EHCI driver for different archs



Commit message:

Make EHCI driver to be build for different archs.
Contributed by David Galvez.
Index: sys/usb/src.km/ucd/ehci/.cvsignore
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/ucd/ehci/.cvsignore,v
retrieving revision 1.1
diff -u -8 -r1.1 .cvsignore
--- sys/usb/src.km/ucd/ehci/.cvsignore	2 May 2014 09:47:24 -0000	1.1
+++ sys/usb/src.km/ucd/ehci/.cvsignore	7 Nov 2014 09:32:54 -0000
@@ -1,2 +1,3 @@
 .deps
 ehci-pci.ucd
+.compile_*
Index: sys/usb/src.km/ucd/ehci/EHCIDEFS
===================================================================
RCS file: sys/usb/src.km/ucd/ehci/EHCIDEFS
diff -N sys/usb/src.km/ucd/ehci/EHCIDEFS
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sys/usb/src.km/ucd/ehci/EHCIDEFS	7 Nov 2014 09:32:54 -0000
@@ -0,0 +1,66 @@
+#
+# debug flags
+#
+# -DDEV_DEBUG		include debugging information
+
+
+ifeq ($(ehci),deb)
+TARGET = ehci.ucd
+CPU = 020-60
+USBDEFS += -DDEV_DEBUG
+LDEXTRA = -nostdlib -Wl,--entry -Wl,_init
+endif
+
+#ifeq ($(ehci),prg)
+#TARGET = ehci.prg
+#CPU = 000
+#USBDEFS += -DTOSONLY -fno-builtin
+#LDEXTRA = -nostdlib -Wl,--entry -Wl,__start
+#endif
+
+ifeq ($(ehci),000)
+TARGET = ehci.ucd
+CPU = 000
+USBDEFS +=
+LDEXTRA = -nostdlib -Wl,--entry -Wl,_init
+endif
+
+ifeq ($(ehci),02060)
+TARGET = ehci.ucd
+CPU = 020-60
+USBDEFS +=
+LDEXTRA = -nostdlib -Wl,--entry -Wl,_init
+endif
+
+ifeq ($(ehci),030)
+TARGET = ehci.ucd
+CPU = 030
+USBDEFS +=
+LDEXTRA = -nostdlib -Wl,--entry -Wl,_init
+endif
+
+ifeq ($(ehci),040)
+TARGET = ehci.ucd
+CPU = 040
+USBDEFS +=
+LDEXTRA = -nostdlib -Wl,--entry -Wl,_init
+endif
+
+ifeq ($(ehci),060)
+TARGET = ehci.ucd
+CPU = 060
+USBDEFS +=
+LDEXTRA = -nostdlib -Wl,--entry -Wl,_init
+endif
+
+ifeq ($(ehci),col)
+TARGET = ehci.ucd
+CPU  = v4e
+USBDEFS += -DCOLDFIRE
+LDEXTRA = -nostdlib -Wl,--entry -Wl,_init
+endif
+
+#
+# all default targets
+#
+ehcitargets = 02060 030 040 060 deb 000 col #prg
Index: sys/usb/src.km/ucd/ehci/Makefile
===================================================================
RCS file: /mint/freemint/sys/usb/src.km/ucd/ehci/Makefile,v
retrieving revision 1.3
diff -u -8 -r1.3 Makefile
--- sys/usb/src.km/ucd/ehci/Makefile	16 Jul 2014 16:31:43 -0000	1.3
+++ sys/usb/src.km/ucd/ehci/Makefile	7 Nov 2014 09:32:54 -0000
@@ -1,37 +1,63 @@
 #
-# Makefile for ucd module
+# Makefile for ehci
 #
-TARGET = ehci-pci.ucd
 
 SHELL = /bin/sh
 SUBDIRS = 
 
 srcdir = .
 top_srcdir = ../../../..
-subdir = ehci-pci
+subdir = ehci
 
-default: all
+default:
+
+include ./EHCIDEFS
 
 include $(top_srcdir)/CONFIGVARS
 include $(top_srcdir)/RULES
 include $(top_srcdir)/PHONY
 
-all-here: $(TARGET)
+
+all-here: all-targets
 
 # default overwrites
-INCLUDES = -I$(top_srcdir)
-DEFINITIONS = -D__KERNEL_MODULE__ -DMODULE_NAME=ehci-pci $(XDD_DEFINITIONS)
-XDD_DEFINITIONS = 
-
-LD = $(CC) -nostdlib -Wl,--entry -Wl,_init
-LIBS = $(LIBKERN) -lgcc
-CPU = 000
 
 # default definitions
-SGENFILES = $(TARGET)
-OBJS = $(SSOBJS:.S=.o) $(COBJS:.c=.o)
+compile_all_dirs = .compile_*
+GENFILES = $(compile_all_dirs) *.ucd *.prg
+
+all-targets:
+	@set fnord $(MAKEFLAGS); amf=$$2; \
+	for i in $(ehcitargets); do \
+		echo "Making $$i"; \
+		($(MAKE) $$i) \
+		|| case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
+	done && test -z "$$fail"
+
+$(ehcitargets): 
+	$(MAKE) buildehci ehci=$@
+
+#
+# multi target stuff
+#
+
+ifneq ($(ehci),)
+
+compile_dir = .compile_$(ehci)
+ehcitarget = _stmp_$(ehci)
+realtarget = $(ehcitarget)
+
+$(ehcitarget): $(compile_dir)
+	cd $(compile_dir); $(MAKE) all
+
+$(compile_dir): Makefile.objs
+	$(MKDIR) -p $@
+	$(CP) $< $@/Makefile
+
+else
+
+realtarget =
 
-$(TARGET): $(OBJS) $(LIBKERNTARGET)
-	$(LD) $(CFLAGS) -o $@ $(OBJS) $(LIBS)
+endif
 
-include $(top_srcdir)/DEPENDENCIES
+buildehci: $(realtarget)
Index: sys/usb/src.km/ucd/ehci/Makefile.objs
===================================================================
RCS file: sys/usb/src.km/ucd/ehci/Makefile.objs
diff -N sys/usb/src.km/ucd/ehci/Makefile.objs
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sys/usb/src.km/ucd/ehci/Makefile.objs	7 Nov 2014 09:32:54 -0000
@@ -0,0 +1,58 @@
+#
+# Makefile for ehci
+#
+
+SHELL = /bin/sh
+SUBDIRS =
+
+srcdir = ..
+top_srcdir = ../../../../..
+subdir = $(compile_dir)
+
+default: all
+
+include ../EHCIDEFS
+
+include $(top_srcdir)/CONFIGVARS
+include $(top_srcdir)/RULES
+include $(top_srcdir)/PHONY
+
+
+all-here: build
+
+# default overwrites
+DEFINITIONS = -D__KERNEL_MODULE__ -DMODULE_NAME=ehci $(USBDEFS)
+
+INCLUDES += -I$(top_srcdir)/../../sys
+WARN = 	-Wall \
+	-Wmissing-prototypes \
+	-Wshadow \
+	-Wpointer-arith \
+
+
+LIBS = $(LIBKERN) -lgcc
+STRIPFLAGS =
+
+# default definitions
+GENFILES = $(TARGET)
+OBJS = $(COBJS:.c=.o) $(SOBJS:.s=.o) $(SSOBJS:.S=.o)
+ifeq ($(TARGET),ehci.prg)
+OBJS += $(TOSCOBJS:.c=.o) $(TOSSSOBJS:.S=.o)
+endif
+
+VPATH = ..
+
+#
+# main target
+#
+build: $(TARGET)
+
+$(TARGET): $(OBJS) $(LIBKERNTARGET)
+	$(CC) $(LDEXTRA) -o $@ $(CFLAGS) $(OBJS) $(LIBS)
+	
+$(OBJS): ../EHCIDEFS
+
+
+# default dependencies
+# must be included last
+include $(top_srcdir)/DEPENDENCIES