| 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 | #LINKER=ibm
|
|---|
| 77 | LINKER=watcom
|
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 | #AS = $(DDK)\tools\alp.exe
|
|---|
| 81 | #AS = jwasm -Cp
|
|---|
| 82 | AS = wasm
|
|---|
| 83 | CC = wcc
|
|---|
| 84 | LD = $(DDK)\base\tools\link.exe
|
|---|
| 85 | BLDLEVEL = cmd.exe /c ..\..\tools\bldlvl.cmd
|
|---|
| 86 | BLDDATE = cmd.exe /c ..\..\tools\blddate.cmd
|
|---|
| 87 | MAPSYM = $(DDK)\base\tools\mapsym.exe
|
|---|
| 88 |
|
|---|
| 89 | #AFLAGS = -Mb
|
|---|
| 90 | #CFLAGS = -ei -5 -d3 -hc -bt=os2 -ms -zu -w3 -wcd=138 -wcd=300 -ecc -zp1 -q -s -zgp -zfp -oi
|
|---|
| 91 | CFLAGS = -ei -5 -d0 -bt=os2 -ms -zu -w=0 -ecc -zp=1 -q -s -zgp -zfp -oi
|
|---|
| 92 | CFLAGS_DEBUG = -ei -5 -d3 -hc -bt=os2 -ms -zu -ecc -zp=1 -q -s -zgp -zfp -od
|
|---|
| 93 |
|
|---|
| 94 | LFLAGS = /noe /nod /packd /a:16 /batch /map /line
|
|---|
| 95 |
|
|---|
| 96 | ###############################################################################
|
|---|
| 97 | # Main dependencies
|
|---|
| 98 |
|
|---|
| 99 | TARGET = os2ahci.add
|
|---|
| 100 |
|
|---|
| 101 | #LIBS = addcalls doscalls rmcalls apmcalls # dhcalls not needed, see local devhelp.h
|
|---|
| 102 | LIBS = addcalls doscalls rmcalls apmcalls dhcalls
|
|---|
| 103 |
|
|---|
| 104 | SRCS = init.asm math.asm libc.c os2ahci.c pci.c ahci.c ata.c atapi.c \
|
|---|
| 105 | ctxhook.c trace.c ioctl.c apm.c
|
|---|
| 106 |
|
|---|
| 107 | OBJS = init.obj libc.obj os2ahci.obj pci.obj ahci.obj ata.obj atapi.obj \
|
|---|
| 108 | ctxhook.obj trace.obj ioctl.obj apm.obj
|
|---|
| 109 |
|
|---|
| 110 | INCS = os2ahci.h ahci.h version.h
|
|---|
| 111 |
|
|---|
| 112 |
|
|---|
| 113 | all: $(TARGET)
|
|---|
| 114 |
|
|---|
| 115 | clean:
|
|---|
| 116 | rm -f $(OBJS) $(TARGET) *.cod *.lst *.def *.map *.sym *.err *.lnk \
|
|---|
| 117 | bldday.h
|
|---|
| 118 |
|
|---|
| 119 | ###############################################################################
|
|---|
| 120 | # Object/source dependencies
|
|---|
| 121 |
|
|---|
| 122 | init.obj: $*.asm wmakefile
|
|---|
| 123 |
|
|---|
| 124 | libc.obj: $*.c wmakefile $(INCS)
|
|---|
| 125 |
|
|---|
| 126 | os2ahci.obj: $*.c wmakefile $(INCS) bldday.h ioctl.h
|
|---|
| 127 |
|
|---|
| 128 | pci.obj: $*.c wmakefile $(INCS)
|
|---|
| 129 |
|
|---|
| 130 | ahci.obj: $*.c wmakefile $(INCS) ata.h atapi.h
|
|---|
| 131 |
|
|---|
| 132 | ata.obj: $*.c wmakefile $(INCS) $*.h
|
|---|
| 133 |
|
|---|
| 134 | atapi.obj: $*.c wmakefile $(INCS) $*.h ata.h
|
|---|
| 135 |
|
|---|
| 136 | ctxhook.obj: $*.c wmakefile $(INCS) ata.h atapi.h
|
|---|
| 137 |
|
|---|
| 138 | apm.obj: $*.c wmakefile $(INCS)
|
|---|
| 139 |
|
|---|
| 140 | ioctl.obj: $*.c wmakefile $(INCS) $*.h atapi.h
|
|---|
| 141 |
|
|---|
| 142 | trace.obj: $*.c wmakefile $(INCS)
|
|---|
| 143 |
|
|---|
| 144 | os2ahci.def: version.h $*.def.template
|
|---|
| 145 |
|
|---|
| 146 | ###############################################################################
|
|---|
| 147 | # Action definitions (compile/link commands)
|
|---|
| 148 |
|
|---|
| 149 | # emacs TAGS file creation
|
|---|
| 150 | # NOTE: OS/2 emacs etags.exe expects an empty file named c:\dev\null...
|
|---|
| 151 | tags: $(SRCS) $(INCS)
|
|---|
| 152 | etags.exe $(SRCS) $(INCS)
|
|---|
| 153 |
|
|---|
| 154 | bldday.h:
|
|---|
| 155 | $(BLDDATE) > bldday.h
|
|---|
| 156 |
|
|---|
| 157 | .asm.obj:
|
|---|
| 158 | $(AS) $(AFLAGS) $(AS_INCLUDE) $*.asm
|
|---|
| 159 | wdis -l $*.obj
|
|---|
| 160 |
|
|---|
| 161 | .c.obj:
|
|---|
| 162 | $(CC) $(CFLAGS) $(CC_INCLUDE) $*.c
|
|---|
| 163 | wdis -l $*.obj
|
|---|
| 164 |
|
|---|
| 165 | os2ahci.def:
|
|---|
| 166 | $(BLDLEVEL) $*.def.template $*.def version.h
|
|---|
| 167 |
|
|---|
| 168 | $(TARGET): $(OBJS) $*.def wmakefile
|
|---|
| 169 |
|
|---|
| 170 | !if "$(LINKER)"=="watcom"
|
|---|
| 171 | # Target name, system and type
|
|---|
| 172 | @%create $*.lnk
|
|---|
| 173 | @%append $*.lnk name $*.add
|
|---|
| 174 | @%append $*.lnk sys os2 dll
|
|---|
| 175 | # Merge BLDLEVEL information
|
|---|
| 176 | @%append $*.lnk option
|
|---|
| 177 | @qgrep -y -e "description" $*.def >> $*.lnk
|
|---|
| 178 | # Set various options
|
|---|
| 179 | @%append $*.lnk option protmode
|
|---|
| 180 | @%append $*.lnk option map
|
|---|
| 181 | @%append $*.lnk option quiet
|
|---|
| 182 | @%append $*.lnk option nocase
|
|---|
| 183 | @%append $*.lnk option stack=0
|
|---|
| 184 | # Generate directives for objects, libraries and library search-paths
|
|---|
| 185 | @for %f in ($(OBJS)) do @%append $*.lnk file %f
|
|---|
| 186 | @for %f in ($(LIBS)) do @%append $*.lnk lib %f
|
|---|
| 187 | @for %f in ($(LIB_DIRS)) do @%append $*.lnk libpath %f
|
|---|
| 188 | # Attributes for the DATA and CODE segments
|
|---|
| 189 | @%append $*.lnk segment type DATA SHARED
|
|---|
| 190 | @%append $*.lnk segment type CODE IOPL
|
|---|
| 191 | # Order segments by class
|
|---|
| 192 | @%append $*.lnk order
|
|---|
| 193 | @%append $*.lnk clname 'DATA'
|
|---|
| 194 | @%append $*.lnk clname 'CONST'
|
|---|
| 195 | @%append $*.lnk clname 'BSS'
|
|---|
| 196 | @%append $*.lnk clname 'CODE'
|
|---|
| 197 | # Link the stuff together and build the target
|
|---|
| 198 | wlink @$*.lnk
|
|---|
| 199 |
|
|---|
| 200 | !elseif "$(LINKER)"=="ibm"
|
|---|
| 201 | $(LD) $(LFLAGS) $(OBJS),$(TARGET),$*.map,$(LIB_DIRS) $(LIBS),$*.def
|
|---|
| 202 | mapsym $*
|
|---|
| 203 | !else
|
|---|
| 204 | @echo "Error: No valid linker specified"
|
|---|
| 205 | !endif
|
|---|
| 206 |
|
|---|