Makefile 5.11 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
# 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}
21
DIRS            = o._dirs
22
MSGLOC          = Resources.${COMPONENT}.Messages
23
DEVICELIST      = Resources.<Locale>.USBDevs
Kevin Bracey's avatar
Kevin Bracey committed
24 25
#LIBS		= ${DEBUGLIB} ${NET5LIBS} ${CALLXLIB} ${ASMUTILS} ${TBOXLIBS}
LIBS            = ${DEBUGLIB} ${MODMALLOCLIB} ${WILDLIB} ${DDTLIB} ${DESKLIB}  ${NET5LIBS} ${CALLXLIB} ${ASMUTILS} ${TBOXLIBS}
26
RDIR            = ${RESDIR}.${COMPONENT}
27
USBDIR          = <Lib$Dir>.USB
28

29
CINCLUDES       = -Itbox:,TCPIPLibs:,^.,OS:
30
CDEFINES        += ${CDEBUG} -DKERNEL -D_KERNEL -Dpaddr_t=int -D__P(A)=A -DKLD_MODULE -DDISABLE_PACKED
31
CMHGINCLUDES    = ${CINCLUDES}
32
CMHGDEFINES     = -DMSGLOC=${MSGLOC} ${CDEBUG}
33
CFLAGS          += -ff -wp -wc -zm -zps1
Ben Avison's avatar
Ben Avison committed
34
LDFLAGS         = -LIST maps.${TARGET} -MAP -Xref -Symbols rm.sym${TARGET}
35 36 37 38 39 40 41 42 43 44 45 46 47

VPATH = ^.build ^.dev.usb

include OBJ${COMPONENT}

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

clean:
48 49 50 51 52 53 54 55 56
        ${WIPE} o      ${WFLAGS}
        ${WIPE} aif    ${WFLAGS}
        ${WIPE} aof    ${WFLAGS}
        ${WIPE} rm     ${WFLAGS}
        ${WIPE} i      ${WFLAGS}
        ${WIPE} maps   ${WFLAGS}
        ${WIPE} gpa    ${WFLAGS}
        ${WIPE} bin    ${WFLAGS}
        ${WIPE} linked ${WFLAGS}
57
        ${RM}   h.ehcimodhead
58 59
        ${RM}   h.ohcimodhead
        ${RM}   h.usbmodhead
60
        ${RM}   Resources.<Locale>.USBDevs
61 62 63

all: o._dirs

64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
export: export_${PHASE}

export_libs:
        @echo ${COMPONENT}: export complete (libs)

export_hdrs:
        ${MKDIR} ${USBDIR}.dev.usb.h
        ${MKDIR} ${USBDIR}.h
        ${MKDIR} ${USBDIR}.sys.h
        ${CP} ^.dev.usb.h.usb      ${USBDIR}.dev.usb.h.usb      ${CPFLAGS}
        ${CP} ^.dev.usb.h.usbdevs  ${USBDIR}.dev.usb.h.usbdevs  ${CPFLAGS}
        ${CP} ^.dev.usb.h.usbdi    ${USBDIR}.dev.usb.h.usbdi    ${CPFLAGS}
        ${CP} ^.dev.usb.h.usb_port ${USBDIR}.dev.usb.h.usb_port ${CPFLAGS}
        ${CP} h.USBDevFS           ${USBDIR}.h.USBDevFS         ${CPFLAGS}
        ${CP} ^.sys.h.device       ${USBDIR}.sys.h.device       ${CPFLAGS}
        ${CP} ^.VersionNum         ${USBDIR}.NetBSDVersion      ${CPFLAGS}
        @echo ${COMPONENT}: export complete (hdrs)

82 83 84 85 86 87 88
resources: resources_${COMPONENT}

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

89 90 91 92 93
resources_EHCIDriver: LocalRes:EHCIMessages
        ${MKDIR} ${RDIR}
        ${CP} LocalRes:EHCIMessages ${RDIR}.Messages ${CPFLAGS}
        @echo ${COMPONENT}: resource files copied

94
resources_USBDriver: LocalRes:USBDriver ${DEVICELIST}
95 96
        ${MKDIR} ${RDIR}
        ${CP} LocalRes:USBMessages ${RDIR}.Messages ${CPFLAGS}
97
        ${CP} ${DEVICELIST} ${RDIR}.USBDevs ${CPFLAGS}
98 99 100
        @echo ${COMPONENT}: resource files copied

o._dirs:
101 102 103 104 105 106 107 108 109 110
        ${MKDIR} o
        ${MKDIR} aif
        ${MKDIR} aof
        ${MKDIR} rm
        ${MKDIR} i
        ${MKDIR} maps
        ${MKDIR} gpa
        ${MKDIR} bin
        ${TOUCH} o._dirs

111
ehcimodule.o:   ehcimodhead.h
112 113
ohcimodule.o:   ohcimodhead.h USBDriver.h
usbmodule.o usbkboard.o:        usbmodhead.h
114

115
Resources.<Locale>.USBDevs: bin.makedevs
116
        bin.makedevs > Resources.<Locale>.USBDevs
117 118 119 120

# 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
121 122 123
        ${SED} -n "/define USBDriver_/p" h.usbmodhead > h.USBDriver
        ${RM}   h.usbmodhead
        ${RM}   o.usbmodhead
124

125
bin.makedevs: o.makedevs ${CLIB} ${DIRS}
126
        ${LD} -o $@ o.makedevs ${CLIB}
127

128 129
usbmsgs.o: Resources.<Locale>.USBMessages Resources.<Locale>.USBDevs
        resgen resource_files o.usbmsgs Resources.<Locale>.USBMessages ${MSGLOC} Resources.<Locale>.USBDevs Resources.USBDriver.USBDevs
130

131 132
ohcimsgs.o: Resources.<Locale>.OHCIMessages
        resgen resource_files o.ohcimsgs Resources.<Locale>.OHCIMessages ${MSGLOC}
133

134 135 136
ehcimsgs.o: Resources.<Locale>.EHCIMessages
        resgen resource_files o.ehcimsgs Resources.<Locale>.EHCIMessages ${MSGLOC}

137 138 139 140 141 142 143 144 145 146 147
# 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

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

150
listing: i.ohci i.ohcimodule i.usb i.usbdi i.usbdi_util i.usb_subr i.ugen i.usbmodule i.ehcimodule
151 152 153


# Dynamic dependencies: