Makefile 3.43 KB
Newer Older
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
# Copyright 2003 Tematic Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Make file for RISC OS port of NetBSD USB code
# 
# This makefile generates the main USBDriver and the controller drivers
# by including the relevant object file.

TARGET          = ${COMPONENT}
DIRS		= o._dirs
MESSAGELOCATION = Resources.${COMPONENT}.Messages
LIBS		= ${DEBUGLIB} ${NET5LIBS} ${CALLXLIB} ${ASMUTILS} ${TBOXLIBS}
RDIR      	= ${RESDIR}.${COMPONENT}

CINCLUDES	= -Itbox:,TCPIPLibs:,^.,OS:
CDEFINES	+= ${CDEBUG} -DKERNEL -Dpaddr_t=int -D__P(A)=A -DKLD_MODULE
CMHGINCLUDES	= ${CINCLUDES}
CMHGDEFINES     = -DMESSAGELOCATION=${MESSAGELOCATION} ${CDEBUG}
CFLAGS		+= -throwback -wp -wc -zm -zps1
LDFLAGS		= -LIST maps.${TARGET} -MAP -Xref

VPATH = ^.build ^.dev.usb

include OBJ${COMPONENT}

include StdTools
include ModStdRule
#MODSQZ = echo not squeezing... 
include ModuleLibs
include RAMCModule
include ROMCModule

clean:
	${WIPE}	o    ${WFLAGS}
	${WIPE} aif  ${WFLAGS}
	${WIPE} aof  ${WFLAGS}
	${WIPE} rm   ${WFLAGS}
	${WIPE} i    ${WFLAGS}
	${WIPE} maps ${WFLAGS}
	${WIPE} gpa  ${WFLAGS}
	${WIPE} bin  ${WFLAGS}
	${RM}	h.ohcimodhead
	${RM}   h.usbmodhead
	${RM}   Resources.UK.USBDevs

all: o._dirs

resources: resources_${COMPONENT}

resources_OHCIDriver: LocalRes:OHCIMessages
        ${MKDIR} ${RDIR}
        ${CP} LocalRes:OHCIMessages ${RDIR}.Messages ${CPFLAGS}
        @echo ${COMPONENT}: resource files copied

resources_USBDriver: LocalRes:USBDriver LocalRes:USBDevs
        ${MKDIR} ${RDIR}
        ${CP} LocalRes:USBMessages ${RDIR}.Messages ${CPFLAGS}
        ${CP} LocalRes:USBDevs ${RDIR}.USBDevs ${CPFLAGS}
        @echo ${COMPONENT}: resource files copied

o._dirs:
	${MKDIR} o
	${MKDIR} aif
	${MKDIR} aof
	${MKDIR} rm
	${MKDIR} i
	${MKDIR} maps
	${MKDIR} gpa
	${MKDIR} bin
	${TOUCH} o._dirs

ohcimodule.o:	ohcimodhead.h USBDriver.h
usbmodule.o usbkboard.o:	usbmodhead.h

Resources.UK.USBDevs: bin.makedevs
	bin.makedevs > Resources.UK.USBDevs

# Remove the usbmodhead after creating the SWI table because if OHCIDriver
# makes it then it has the wrong messages file in it
USBDriver.h: usbmodhead.h
	${SED} -n "/define USBDriver_/p" h.usbmodhead > h.USBDriver
	${RM}   h.usbmodhead
	${RM}   o.usbmodhead

bin.makedevs: o.makedevs ${CLIB}
97
	${LD} -o $@ o.makedevs ${CLIB}
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121

usbmsgs.o: Resources.UK.USBMessages Resources.UK.USBDevs
        resgen resource_files o.usbmsgs Resources.UK.USBMessages ${MESSAGELOCATION} Resources.UK.USBDevs Resources.USBDriver.USBDevs

ohcimsgs.o: Resources.UK.OHCIMessages
        resgen resource_files o.ohcimsgs Resources.UK.OHCIMessages ${MESSAGELOCATION}

# RISC OS debug:
aif.${COMPONENT}: ${RAM_OBJS} ${RAM_LIBS} ${CLIB} ${DIRS}
        link -base 0 -aif -bin -d -o $@ ${RAM_OBJS} ${RAM_LIBS} ${CLIB}

gpa.${COMPONENT}: aif.${COMPONENT}
        togpa -s aif.${COMPONENT} $@

debug: gpa.${COMPONENT} ${DIRS}

.SUFFIXES: .i

.c.i:;	${CC} -E ${CFLAGS} $< > $@

listing: i.ohci i.ohcimodule i.usb i.usbdi i.usbdi_util i.usb_subr i.ugen i.usbmodule


# Dynamic dependencies: