| 1 | ###############################################################################
|
|---|
| 2 | # wmakefile - makefile for os2ahci driver using WATCOM compiler
|
|---|
| 3 | #
|
|---|
| 4 | # Copyright (c) 2010 Christian Mueller, Markus Thielen.
|
|---|
| 5 | # Parts copied from/inspired by the Linux AHCI driver;
|
|---|
| 6 | # those parts are (c) Linux AHCI/ATA maintainers
|
|---|
| 7 | #
|
|---|
| 8 | # This program is free software; you can redistribute it and/or modify
|
|---|
| 9 | # it under the terms of the GNU General Public License as published by
|
|---|
| 10 | # the Free Software Foundation; either version 2 of the License, or
|
|---|
| 11 | # (at your option) any later version.
|
|---|
| 12 | #
|
|---|
| 13 | # This program is distributed in the hope that it will be useful,
|
|---|
| 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 16 | # GNU General Public License for more details.
|
|---|
| 17 | #
|
|---|
| 18 | # You should have received a copy of the GNU General Public License
|
|---|
| 19 | # along with this program; if not, write to the Free Software
|
|---|
| 20 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 21 |
|
|---|
| 22 | ###############################################################################
|
|---|
| 23 | # Calling Syntax
|
|---|
| 24 | #
|
|---|
| 25 | # wmake -ms -f wmakefile
|
|---|
| 26 | #
|
|---|
| 27 | # NOTE: we use MS compatibility mode (-ms) so we can use a syntax similar
|
|---|
| 28 | # to the well known nmake syntax.
|
|---|
| 29 | #
|
|---|
| 30 |
|
|---|
| 31 | ###############################################################################
|
|---|
| 32 | # wmake directives
|
|---|
| 33 | .HOLD # do not prompt for deletion of created files on error; leave them alone
|
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 | ###############################################################################
|
|---|
| 38 | # Environment
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | # main path to OS/2 DDK; this needs to be set before this makefile will work
|
|---|
| 42 | !ifndef DDK
|
|---|
| 43 | DDK = i:\ddk
|
|---|
| 44 | !endif
|
|---|
| 45 |
|
|---|
| 46 | # main path to WATCOM installation
|
|---|
| 47 | !ifndef WATCOM
|
|---|
| 48 | WATCOM = i:\watcom
|
|---|
| 49 | !endif
|
|---|
| 50 |
|
|---|
| 51 | CC_INCLUDE = -I..\include \
|
|---|
| 52 | -I$(DDK)\base\h \
|
|---|
| 53 | -I$(DDK)\base\ibmh \
|
|---|
| 54 | -I$(DDK)\base\src\dev\dasd\diskh \
|
|---|
| 55 | -I$(DDK)\base\src\dev\thinkpad\dockii\apmcalls \
|
|---|
| 56 | # -I$(CC16)\include
|
|---|
| 57 |
|
|---|
| 58 | AS_INCLUDE = -I=$(DDK)\base\inc \
|
|---|
| 59 | -I=$(DDK)\base\src\dev\dasd\diskinc
|
|---|
| 60 |
|
|---|
| 61 | LIB_DIRS = $(DDK)\base\lib\ \
|
|---|
| 62 | $(DDK)\base\src\dev\dasd\devhlp\ \
|
|---|
| 63 | $(DDK)\base\src\dev\thinkpad\dockii\apmcalls\ \
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 |
|
|---|
| 67 |
|
|---|
| 68 | ###############################################################################
|
|---|
| 69 | # Tool Chain
|
|---|
| 70 | #
|
|---|
| 71 | # This makefile uses the Watcom 16-bit compiler, Watcom Assembler and Linker.
|
|---|
| 72 | # You can change to the DDK Linker and Assembler by modifying the macros below.
|
|---|
| 73 | #
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 | #
|
|---|
| 79 | # Specify Linker
|
|---|
| 80 | # Note: Using ALP with Wlink produces an oversized image, possibly due to
|
|---|
| 81 | # the location of BSS segments. Putting the BSS segments after the CODE
|
|---|
| 82 | # segments in init.asm and/or segment ordering in the Wlink response file
|
|---|
| 83 | # seems not to work when using ALP.
|
|---|
| 84 | #
|
|---|
| 85 |
|
|---|
| 86 | #LINKER=ibm
|
|---|
| 87 | LINKER=watcom
|
|---|
| 88 |
|
|---|
| 89 | #
|
|---|
| 90 | # Specify Assembler
|
|---|
| 91 | # Note: This will only be of influence on assembling .asm files.
|
|---|
| 92 | # C inline _asm statements will use Wasm.
|
|---|
| 93 | #
|
|---|
| 94 |
|
|---|
| 95 | #AS = $(DDK)\tools\alp.exe
|
|---|
| 96 | #AS = jwasm -Cp
|
|---|
| 97 | AS = wasm
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 | CC = wcc
|
|---|
| 101 | LD = $(DDK)\base\tools\link.exe
|
|---|
| 102 | BLDLEVEL = cmd.exe /c ..\..\tools\bldlvl.cmd
|
|---|
| 103 | BLDDATE = cmd.exe /c ..\..\tools\blddate.cmd
|
|---|
| 104 | MAPSYM = $(DDK)\base\tools\mapsym.exe
|
|---|
| 105 |
|
|---|
| 106 | #AFLAGS = -Mb
|
|---|
| 107 | #CFLAGS = -ei -5 -d3 -hc -bt=os2 -ms -zu -w3 -wcd=138 -wcd=300 -ecc -zp1 -q -s -zgp -zfp -oi
|
|---|
| 108 | CFLAGS = -ei -5 -d0 -bt=os2 -ms -zu -w=0 -ecc -zp=1 -q -s -zgp -zfp -oi
|
|---|
| 109 | CFLAGS_DEBUG = -ei -5 -d3 -hc -bt=os2 -ms -zu -ecc -zp=1 -q -s -zgp -zfp -od
|
|---|
| 110 |
|
|---|
| 111 | LFLAGS = /noe /nod /packd /a:16 /batch /map /line
|
|---|
| 112 |
|
|---|
| 113 | ###############################################################################
|
|---|
| 114 | # Main dependencies
|
|---|
| 115 |
|
|---|
| 116 | TARGET = os2ahci.add
|
|---|
| 117 |
|
|---|
| 118 | #LIBS = addcalls doscalls rmcalls apmcalls # dhcalls not needed, see local devhelp.h
|
|---|
| 119 | LIBS = addcalls doscalls rmcalls apmcalls dhcalls
|
|---|
| 120 |
|
|---|
| 121 | SRCS = init.asm math.asm libc.c os2ahci.c pci.c ahci.c ata.c atapi.c \
|
|---|
| 122 | ctxhook.c trace.c ioctl.c apm.c
|
|---|
| 123 |
|
|---|
| 124 | OBJS = init.obj libc.obj os2ahci.obj pci.obj ahci.obj ata.obj atapi.obj \
|
|---|
| 125 | ctxhook.obj trace.obj ioctl.obj apm.obj
|
|---|
| 126 |
|
|---|
| 127 | INCS = os2ahci.h ahci.h version.h
|
|---|
| 128 |
|
|---|
| 129 |
|
|---|
| 130 | all: $(TARGET)
|
|---|
| 131 |
|
|---|
| 132 | clean:
|
|---|
| 133 | rm -f $(OBJS) $(TARGET) *.cod *.lst *.def *.map *.sym *.err *.lnk \
|
|---|
| 134 | bldday.h
|
|---|
| 135 |
|
|---|
| 136 | ###############################################################################
|
|---|
| 137 | # Object/source dependencies
|
|---|
| 138 |
|
|---|
| 139 | init.obj: $*.asm wmakefile
|
|---|
| 140 |
|
|---|
| 141 | libc.obj: $*.c wmakefile $(INCS)
|
|---|
| 142 |
|
|---|
| 143 | os2ahci.obj: $*.c wmakefile $(INCS) bldday.h ioctl.h
|
|---|
| 144 |
|
|---|
| 145 | pci.obj: $*.c wmakefile $(INCS)
|
|---|
| 146 |
|
|---|
| 147 | ahci.obj: $*.c wmakefile $(INCS) ata.h atapi.h
|
|---|
| 148 |
|
|---|
| 149 | ata.obj: $*.c wmakefile $(INCS) $*.h
|
|---|
| 150 |
|
|---|
| 151 | atapi.obj: $*.c wmakefile $(INCS) $*.h ata.h
|
|---|
| 152 |
|
|---|
| 153 | ctxhook.obj: $*.c wmakefile $(INCS) ata.h atapi.h
|
|---|
| 154 |
|
|---|
| 155 | apm.obj: $*.c wmakefile $(INCS)
|
|---|
| 156 |
|
|---|
| 157 | ioctl.obj: $*.c wmakefile $(INCS) $*.h atapi.h
|
|---|
| 158 |
|
|---|
| 159 | trace.obj: $*.c wmakefile $(INCS)
|
|---|
| 160 |
|
|---|
| 161 | os2ahci.def: version.h $*.def.template
|
|---|
| 162 |
|
|---|
| 163 | ###############################################################################
|
|---|
| 164 | # Action definitions (compile/link commands)
|
|---|
| 165 |
|
|---|
| 166 | # emacs TAGS file creation
|
|---|
| 167 | # NOTE: OS/2 emacs etags.exe expects an empty file named c:\dev\null...
|
|---|
| 168 | tags: $(SRCS) $(INCS)
|
|---|
| 169 | etags.exe $(SRCS) $(INCS)
|
|---|
| 170 |
|
|---|
| 171 | bldday.h:
|
|---|
| 172 | $(BLDDATE) > bldday.h
|
|---|
| 173 |
|
|---|
| 174 | .asm.obj:
|
|---|
| 175 | $(AS) $(AFLAGS) $(AS_INCLUDE) $*.asm
|
|---|
| 176 | wdis -l $*.obj
|
|---|
| 177 |
|
|---|
| 178 | .c.obj:
|
|---|
| 179 | $(CC) $(CFLAGS) $(CC_INCLUDE) $*.c
|
|---|
| 180 | wdis -l $*.obj
|
|---|
| 181 |
|
|---|
| 182 | os2ahci.def:
|
|---|
| 183 | $(BLDLEVEL) $*.def.template $*.def version.h
|
|---|
| 184 |
|
|---|
| 185 | $(TARGET): $(OBJS) $*.def wmakefile
|
|---|
| 186 |
|
|---|
| 187 | !if "$(LINKER)"=="watcom"
|
|---|
| 188 | # Target name, system and type
|
|---|
| 189 | @%create $*.lnk
|
|---|
| 190 | @%append $*.lnk name $*.add
|
|---|
| 191 | @%append $*.lnk sys os2 dll
|
|---|
| 192 | # Merge BLDLEVEL information
|
|---|
| 193 | @%append $*.lnk option
|
|---|
| 194 | @qgrep -y -e "description" $*.def >> $*.lnk
|
|---|
| 195 | # Set various options
|
|---|
| 196 | @%append $*.lnk option protmode
|
|---|
| 197 | @%append $*.lnk option map
|
|---|
| 198 | @%append $*.lnk option quiet
|
|---|
| 199 | @%append $*.lnk option nocase
|
|---|
| 200 | @%append $*.lnk option stack=0
|
|---|
| 201 | # Generate directives for objects, libraries and library search-paths
|
|---|
| 202 | @for %f in ($(OBJS)) do @%append $*.lnk file %f
|
|---|
| 203 | @for %f in ($(LIBS)) do @%append $*.lnk lib %f
|
|---|
| 204 | @for %f in ($(LIB_DIRS)) do @%append $*.lnk libpath %f
|
|---|
| 205 | # Attributes for the DATA and CODE segments
|
|---|
| 206 | @%append $*.lnk segment type DATA SHARED
|
|---|
| 207 | @%append $*.lnk segment type CODE IOPL
|
|---|
| 208 | # Order segments by class
|
|---|
| 209 | @%append $*.lnk order
|
|---|
| 210 | @%append $*.lnk clname 'DATA'
|
|---|
| 211 | @%append $*.lnk clname 'CONST'
|
|---|
| 212 | @%append $*.lnk clname 'BSS'
|
|---|
| 213 | @%append $*.lnk clname 'CODE'
|
|---|
| 214 | # Link the stuff together and build the target
|
|---|
| 215 | wlink @$*.lnk
|
|---|
| 216 |
|
|---|
| 217 | !elseif "$(LINKER)"=="ibm"
|
|---|
| 218 | $(LD) $(LFLAGS) $(OBJS),$(TARGET),$*.map,$(LIB_DIRS) $(LIBS),$*.def
|
|---|
| 219 | mapsym $*
|
|---|
| 220 | !else
|
|---|
| 221 | @echo "Error: No valid linker specified"
|
|---|
| 222 | !endif
|
|---|
| 223 |
|
|---|