| 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 | # THE WATCOM BUILD IS BROKEN!
|
|---|
| 33 | #
|
|---|
| 34 | # It might run through but produces a non-working driver
|
|---|
| 35 | #
|
|---|
| 36 |
|
|---|
| 37 | ###############################################################################
|
|---|
| 38 | # wmake directives
|
|---|
| 39 | .HOLD # do not prompt for deletion of created files on error; leave them alone
|
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
|
|---|
| 43 | ###############################################################################
|
|---|
| 44 | # Environment
|
|---|
| 45 |
|
|---|
| 46 | # main path to OS/2 DDK; this needs to be set before this makefile will work
|
|---|
| 47 | !ifndef DDK
|
|---|
| 48 | DDK = i:\ddk
|
|---|
| 49 | !endif
|
|---|
| 50 |
|
|---|
| 51 | # main path to WATCOM installation
|
|---|
| 52 | !ifndef WATCOM
|
|---|
| 53 | WATCOM = i:\watcom
|
|---|
| 54 | !endif
|
|---|
| 55 |
|
|---|
| 56 | CC_INCLUDE = -I..\include \
|
|---|
| 57 | -I$(DDK)\base\h \
|
|---|
| 58 | -I$(DDK)\base\ibmh \
|
|---|
| 59 | -I$(DDK)\base\src\dev\dasd\diskh \
|
|---|
| 60 | -I$(DDK)\base\src\dev\thinkpad\dockii\apmcalls \
|
|---|
| 61 | -I$(CC16)\include
|
|---|
| 62 |
|
|---|
| 63 | AS_INCLUDE = -I:$(DDK)\base\inc \
|
|---|
| 64 | -I:$(DDK)\base\src\dev\dasd\diskinc
|
|---|
| 65 |
|
|---|
| 66 | LIB_DIRS = $(DDK)\base\lib\ \
|
|---|
| 67 | $(DDK)\base\src\dev\dasd\devhlp\ \
|
|---|
| 68 | $(DDK)\base\src\dev\thinkpad\dockii\apmcalls\ \
|
|---|
| 69 |
|
|---|
| 70 | ###############################################################################
|
|---|
| 71 | # Tool Chain
|
|---|
| 72 | #
|
|---|
| 73 | # This makefile uses the Watcom 16bit compiler.
|
|---|
| 74 | # Linker and assembler are link.exe and alp.exe that ship with the OS/2 DDK
|
|---|
| 75 | #
|
|---|
| 76 |
|
|---|
| 77 | AS = $(DDK)\tools\alp.exe
|
|---|
| 78 | CC = wcc
|
|---|
| 79 | LD = $(DDK)\base\tools\link.exe
|
|---|
| 80 | BLDLEVEL = cmd.exe /c ..\..\tools\bldlvl.cmd
|
|---|
| 81 | BLDDATE = cmd.exe /c ..\..\tools\blddate.cmd
|
|---|
| 82 | MAPSYM = $(DDK)\base\tools\mapsym.exe
|
|---|
| 83 |
|
|---|
| 84 | AFLAGS = -Mb
|
|---|
| 85 | CFLAGS = -d3 -hc -bt=os2 -ms -zu -5 -w3 -wcd=138 -wcd=300 -ecc -zp1 -q -s -zgp -zfp -oi
|
|---|
| 86 | CFLAGS_DEBUG = -d3 -hc
|
|---|
| 87 | LFLAGS = /noe /nod /packd /a:16 /batch /map /line
|
|---|
| 88 |
|
|---|
| 89 | ###############################################################################
|
|---|
| 90 | # Main dependencies
|
|---|
| 91 |
|
|---|
| 92 | TARGET = os2ahci.add
|
|---|
| 93 |
|
|---|
| 94 | LIBS = addcalls doscalls rmcalls apmcalls # dhcalls not needed, see local devhelp.h
|
|---|
| 95 |
|
|---|
| 96 | SRCS = init.asm math.asm libc.c os2ahci.c pci.c ahci.c ata.c atapi.c \
|
|---|
| 97 | ctxhook.c trace.c ioctl.c apm.c
|
|---|
| 98 |
|
|---|
| 99 | OBJS = init.obj libc.obj os2ahci.obj pci.obj ahci.obj ata.obj atapi.obj \
|
|---|
| 100 | ctxhook.obj trace.obj ioctl.obj apm.obj
|
|---|
| 101 |
|
|---|
| 102 | INCS = os2ahci.h ahci.h version.h
|
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 | all: $(TARGET)
|
|---|
| 106 |
|
|---|
| 107 | clean:
|
|---|
| 108 | rm -f $(OBJS) $(TARGET) *.lst *.cod
|
|---|
| 109 |
|
|---|
| 110 | ###############################################################################
|
|---|
| 111 | # Object/source dependencies
|
|---|
| 112 |
|
|---|
| 113 | init.obj: init.asm Makefile
|
|---|
| 114 |
|
|---|
| 115 | libc.obj: libc.c Makefile $(INCS)
|
|---|
| 116 |
|
|---|
| 117 | os2ahci.obj: os2ahci.c Makefile $(INCS) bldday.h ioctl.h
|
|---|
| 118 |
|
|---|
| 119 | pci.obj: pci.c Makefile $(INCS)
|
|---|
| 120 |
|
|---|
| 121 | ahci.obj: ahci.c Makefile $(INCS) ata.h atapi.h
|
|---|
| 122 |
|
|---|
| 123 | ata.obj: ata.c Makefile $(INCS) ata.h
|
|---|
| 124 |
|
|---|
| 125 | atapi.obj: atapi.c Makefile $(INCS) ata.h atapi.h
|
|---|
| 126 |
|
|---|
| 127 | ctxhook.obj: ctxhook.c Makefile $(INCS) ata.h atapi.h
|
|---|
| 128 |
|
|---|
| 129 | apm.obj: apm.c Makefile $(INCS)
|
|---|
| 130 |
|
|---|
| 131 | ioctl.obj: ioctl.c Makefile $(INCS) atapi.h ioctl.h
|
|---|
| 132 |
|
|---|
| 133 | trace.obj: trace.c Makefile $(INCS)
|
|---|
| 134 |
|
|---|
| 135 | os2ahci.def: version.h os2ahci.def.template
|
|---|
| 136 |
|
|---|
| 137 | ###############################################################################
|
|---|
| 138 | # Action definitions (compile/link commands)
|
|---|
| 139 |
|
|---|
| 140 | # emacs TAGS file creation
|
|---|
| 141 | # NOTE: OS/2 emacs etags.exe expects an empty file named c:\dev\null...
|
|---|
| 142 | tags: $(SRCS) $(INCS)
|
|---|
| 143 | etags.exe $(SRCS) $(INCS)
|
|---|
| 144 |
|
|---|
| 145 | bldday.h:
|
|---|
| 146 | $(BLDDATE) > bldday.h
|
|---|
| 147 |
|
|---|
| 148 | .asm.obj:
|
|---|
| 149 | $(AS) $(AFLAGS) $(AS_INCLUDE) $*.asm
|
|---|
| 150 |
|
|---|
| 151 | .c.obj:
|
|---|
| 152 | $(CC) $(CFLAGS) $(CC_INCLUDE) $*.c
|
|---|
| 153 | wdis -l $*.obj
|
|---|
| 154 |
|
|---|
| 155 | os2ahci.def:
|
|---|
| 156 | $(BLDLEVEL) os2ahci.def.template os2ahci.def version.h
|
|---|
| 157 |
|
|---|
| 158 | $(TARGET): $(OBJS) os2ahci.def wmakefile
|
|---|
| 159 | $(LD) $(LFLAGS) $(OBJS),$(TARGET),$*.map,$(LIB_DIRS) $(LIBS),$*.def
|
|---|
| 160 | mapsym os2ahci
|
|---|
| 161 |
|
|---|
| 162 |
|
|---|