Ignore:
Timestamp:
Mar 27, 2013, 5:55:26 AM (12 years ago)
Author:
David Azarewicz
Message:

Fix spin-up / power-up issue on some hardware
Changes to debug output
Fixup makefiles

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/os2ahci/Makefile

    r144 r148  
    11###############################################################################
    2 # Makefile - makefile for os2ahci driver, c600 tool chain
     2# Makefile - makefile for os2ahci driver using WATCOM compiler
    33#
    4 # Copyright (c) 2011 thi.guten Software Development
    5 # Copyright (c) 2011 Mensys B.V.
    6 #
    7 # Authors: Christian Mueller, Markus Thielen
     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
    87#
    98#  This program is free software; you can redistribute it and/or modify
     
    2019#  along with this program; if not, write to the Free Software
    2120#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    22 #
     21
     22
     23###############################################################################
     24# Environment
     25
     26.ERASE
     27.SUFFIXES
     28.SUFFIXES: .lst .obj .c .asm .lib .def
     29
     30# Define default build version if not specified in environment
     31BLD_MAJOR=1
     32BLD_MINOR=26 # must be 2 digits
     33BLD_REV=0 # not used at this time
     34
     35!ifndef %WATCOM # if not defined in the environment
     36!error WATCOM must be set in the environment.
     37!endif
     38WATCOM=$(%WATCOM)
     39
     40!ifndef %DDK # if not defined in the environment
     41!error DDK must be set in the environment.
     42!endif
     43DDK=$(%DDK)
     44
     45!ifdef %VENDOR
     46VENDOR=$(%VENDOR)
     47!else
     48VENDOR=Mensys BV
     49!endif
     50
     51!ifdef %BLD_MAJOR
     52BLD_MAJOR=$(%BLD_MAJOR)
     53!endif
     54
     55!ifdef %BLD_MINOR
     56BLD_MINOR=$(%BLD_MINOR)
     57!endif
     58
     59CC_INCLUDE = -I..\include &
     60             -I$(DDK)\base\h &
     61             -I$(DDK)\base\ibmh &
     62             -I$(DDK)\base\src\dev\dasd\diskh &
     63             -I$(DDK)\base\src\dev\thinkpad\dockii\apmcalls &
     64
     65AS_INCLUDE = -I=$(DDK)\base\inc &
     66             -I=$(DDK)\base\src\dev\dasd\diskinc
     67
     68LIB_DIRS   = $(DDK)\base\lib\ &
     69             $(DDK)\base\src\dev\dasd\devhlp\ &
     70             $(DDK)\base\src\dev\thinkpad\dockii\apmcalls\
    2371
    2472###############################################################################
    2573# Tool Chain
    2674#
     75# This makefile uses the Watcom 16-bit compiler, Watcom Assembler and Linker.
     76# The updated DDK devhelp.h is required and a copy is in the include directory
     77# of this project.
     78#
    2779
    28 AS         = $(DDK)\tools\alp.exe
    29 CC         = cl
    30 LD         = $(DDK)\base\tools\link.exe
     80%PATH=..\..\tools;$(WATCOM)\BINP;$(WATCOM)\BINW;
     81AS         = wasm
     82CC         = wcc
    3183MAPSYM     = $(DDK)\base\tools\mapsym.exe
    32 BLDLEVEL   = cmd.exe /c ..\..\tools\bldlvl.cmd
    33 BLDDATE    = cmd.exe /c ..\..\tools\blddate.cmd
    3484
    35 AFLAGS     = -Mb
    36 CFLAGS     = -c -nologo -Asnw -W2 -G2ms -Zlpd -Fc -Zi -DECS_BUILD
    37 LFLAGS     = /noe /nod /packd /a:16 /batch /map /line
    38 
    39 ###############################################################################
    40 # Environment
    41 
    42 # main path to OS/2 DDK; this needs to be set before this makefile will work
    43 !ifndef DDK
    44 DDK          = i:\ddk
     85!ifdef __LOADDLL__
     86!loaddll wcc   $(WATCOM)\BINP\DLL\wccd.dll
     87!loaddll wlink $(WATCOM)\BINP\DLL\wlinkd.dll
    4588!endif
    4689
    47 # main path to 16 bit C compiler
    48 !ifndef CC16
    49 CC16         = i:\c600
    50 !endif
    51 
    52 CC_INCLUDE   = -I..\include \
    53                -I$(DDK)\base\h \
    54                -I$(DDK)\base\ibmh \
    55                -I$(DDK)\base\src\dev\dasd\diskh \
    56                -I$(DDK)\base\src\dev\thinkpad\dockii\apmcalls \
    57 #               -I$(CC16)\include
    58 
    59 AS_INCLUDE   = -I:$(DDK)\base\inc \
    60                -I:$(DDK)\base\src\dev\dasd\diskinc
    61 
    62 LIB_DIRS     = $(DDK)\base\lib\ \
    63                $(DDK)\base\src\dev\dasd\devhlp\ \
    64                $(DDK)\base\src\dev\thinkpad\dockii\apmcalls\ \
    65 #               $(CC16)\lib\ \
    66 
     90AFLAGS = -q
     91#CFLAGS = -ei -5 -d3 -hc -bt=os2 -ms -zu -w3 -wcd=138 -wcd=300 -ecc -zp1 -q -s -zgp -zfp -oi
     92# In order to build the SMP safe version you must have the updated devhelp.h and define OS2AHCI_SMP.
     93CFLAGS = -ei -5 -d0 -bt=os2 -ms -zu -w=0 -ecc -zp=1 -q -s -zgp -zfp -oi -DOS2AHCI_SMP
     94CFLAGS_DEBUG = -ei -5 -d3 -hc -bt=os2 -ms -zu -ecc -zp=1 -q -s -zgp -zfp -od
    6795
    6896###############################################################################
    6997# Main dependencies
    7098
    71 TARGET   = os2ahci.add
     99LIBS = addcalls doscalls rmcalls apmcalls
    72100
    73 LIBS     = addcalls dhcalls doscalls slibcep rmcalls apmcalls
     101SRCS = init.asm math.asm libc.c os2ahci.c pci.c ahci.c ata.c atapi.c &
     102       ctxhook.c trace.c ioctl.c apm.c
    74103
    75 SRCS     = init.asm libc.c os2ahci.c pci.c ahci.c ata.c atapi.c ctxhook.c \
    76            apm.c ioctl.c trace.c
     104OBJS = init.obj libc.obj os2ahci.obj pci.obj ahci.obj ata.obj atapi.obj &
     105       ctxhook.obj trace.obj ioctl.obj apm.obj
    77106
    78 OBJS     = init.obj libc.obj os2ahci.obj pci.obj ahci.obj ata.obj atapi.obj \
    79            ctxhook.obj apm.obj ioctl.obj trace.obj
     107INCS = os2ahci.h ahci.h
    80108
    81 INCS     = os2ahci.h ahci.h version.h ioctl.h ..\include\ahci-idc.h
     109all: os2ahci.add os2ahci.sym
    82110
    83 
    84 all: $(TARGET)
    85 
    86 clean:
    87         rm -f $(OBJS) $(TARGET) *.cod *.lst *.def *.map *.sym *.err *.lnk \
    88                 bldday.h
    89 
     111clean: .symbolic
     112    rm -f $(OBJS) os2ahci.add *.cod *.lst *.def *.map *.sym *.err *.lnk version.h
    90113
    91114###############################################################################
    92115# Object/source dependencies
    93116
    94 init.obj:     init.asm   Makefile
     117libc.obj: libc.c Makefile $(INCS)
    95118
    96 libc.obj:     libc.c     Makefile $(INCS)
     119os2ahci.obj: os2ahci.c Makefile $(INCS) version.h ioctl.h
    97120
    98 os2ahci.obj:  os2ahci.c  Makefile $(INCS) bldday.h ioctl.h
     121pci.obj: pci.c Makefile $(INCS)
    99122
    100 pci.obj:      pci.c      Makefile $(INCS)
     123ahci.obj: ahci.c Makefile $(INCS) ata.h atapi.h
    101124
    102 ahci.obj:     ahci.c     Makefile $(INCS) ata.h atapi.h
     125ata.obj: ata.c Makefile $(INCS) ata.h
    103126
    104 ata.obj:      ata.c      Makefile $(INCS) ata.h
     127atapi.obj: atapi.c Makefile $(INCS) atapi.h ata.h
    105128
    106 atapi.obj:    atapi.c    Makefile $(INCS) ata.h atapi.h
     129ctxhook.obj: ctxhook.c Makefile $(INCS) ata.h atapi.h
    107130
    108 ctxhook.obj:  ctxhook.c  Makefile $(INCS) ata.h atapi.h
     131apm.obj: apm.c Makefile $(INCS)
    109132
    110 apm.obj:      apm.c      Makefile $(INCS)
     133ioctl.obj: ioctl.c Makefile $(INCS) ioctl.h atapi.h
    111134
    112 ioctl.obj:    ioctl.c    Makefile $(INCS) ata.h atapi.h ioctl.h
    113 
    114 trace.obj:    trace.c    Makefile $(INCS)
    115 
    116 os2ahci.def:  version.h  os2ahci.def.template
     135trace.obj: trace.c Makefile $(INCS)
    117136
    118137###############################################################################
     
    121140# emacs TAGS file creation
    122141# NOTE: OS/2 emacs etags.exe expects an empty file named c:\dev\null...
    123 tags:   $(SRCS) $(INCS) Makefile
    124         etags.exe $(SRCS) $(INCS) $(DDK)\base\src\dev\dasd\diskh\dhcalls.h \
    125         $(DDK)\base\src\dev\dasd\diskh\iorb.h \
    126         $(DDK)\base\h\bsedos16.h \
    127         $(DDK)\base\h\devcmd.h \
    128         $(DDK)\base\h\reqpkt.h
     142tags:   $(SRCS) $(INCS)
     143    etags.exe $(SRCS) $(INCS)
    129144
    130 bldday.h:
    131         $(BLDDATE) > bldday.h
     145version.h: Makefile .always
     146    @%create $^@
     147    @%append $^@ /* Autogenerated by Makefile */
     148    @%append $^@ $#define VERSION $(BLD_MAJOR)$(BLD_MINOR) /* driver version (2 implied decimals) */
     149    @AddToFile $^@,$#define BLD_YEAR,DATEYEAR
     150    @AddToFile $^@,$#define BLD_MONTH,DATEMONTH
     151    @AddToFile $^@,$#define BLD_DAY,DATEDAY
    132152
    133 .asm.obj:
    134         $(AS) $(AFLAGS) $(AS_INCLUDE) $*.asm
    135         wdis -l $*.obj
     153.asm.obj: .autodepend
     154    $(AS) $(AFLAGS) $(AS_INCLUDE) $[@
     155    #wdis -l $^@
    136156
    137 .c.obj:
    138         $(CC) $(CFLAGS) $(CC_INCLUDE) $*.c
    139         wdis -l $*.obj
     157.c.obj: .autodepend
     158    $(CC) $(CFLAGS) $(CC_INCLUDE) $[@
     159    #wdis -l $^@
    140160
    141 os2ahci.def:
    142         $(BLDLEVEL) os2ahci.def.template os2ahci.def version.h
     161os2ahci.add: $(OBJS) Makefile
     162    # Target name, system and type
     163    @%create $*.lnk
     164    @%append $*.lnk name $*.add
     165    @%append $*.lnk sys os2 dll
     166    # Merge BLDLEVEL information
     167        @AddToFile.cmd $*.lnk,option description,BLDLEVEL,$(VENDOR),$(BLD_MAJOR).$(BLD_MINOR),AHCI Driver (c) Mensys BV 2013
     168    # Set various options
     169    @%append $*.lnk option protmode
     170    @%append $*.lnk option map
     171    @%append $*.lnk option quiet
     172    @%append $*.lnk option nocase
     173    @%append $*.lnk option stack=0
     174    # Generate directives for objects, libraries and library search-paths
     175    @for %f in ($(OBJS)) do @%append $*.lnk file %f
     176    @for %f in ($(LIBS)) do @%append $*.lnk lib %f
     177    @for %f in ($(LIB_DIRS)) do @%append $*.lnk libpath %f
     178    # Attributes for the DATA and CODE segments
     179    @%append $*.lnk segment type DATA SHARED
     180    @%append $*.lnk segment type CODE IOPL
     181    # Order segments by class
     182    @%append $*.lnk order
     183    @%append $*.lnk clname 'DATA'
     184    @%append $*.lnk clname 'CONST'
     185    @%append $*.lnk clname 'BSS'
     186    @%append $*.lnk clname 'CODE'
     187    # Link the stuff together and build the target
     188    wlink  @$*.lnk
     189    @%erase $*.lnk
    143190
     191os2ahci.sym: os2ahci.map
     192        wat2map.cmd $[@ $^*.ma1
     193        $(MAPSYM) $^*.ma1
     194        @%erase $^*.ma1
    144195
    145 $(TARGET): $(OBJS) os2ahci.def Makefile
    146         $(LD) $(LFLAGS) $(OBJS),$(TARGET),$*.map,$(LIB_DIRS) $(LIBS),$*.def
    147         $(MAPSYM) os2ahci
Note: See TracChangeset for help on using the changeset viewer.