multiple driver source directories

Hi sorry if this is super basic, but

I’m having trouble figuring out how to use multiple source directories. Not all the .c files are in the same or adjacent directories. I’d like to do something like this in the ‘sources’ file:

TARGETNAME=mydriver
TARGETTYPE=DRIVER
DRIVERTYPE=WDM

MSC_WARNING_LEVEL=-W3 -WX

TARGETPATH=obj

OTHER_SRC_DIR=$(MAKEDIR)....\driver_common

INCLUDES=$(OTHER_SRC_DIR)\include

SOURCES=extended_functionality.rc \
extended_functionality.c \
$(OTHER_SRC_DIR)\base_functionality.c

NMAKE : fatal error U1073: don’t know how to make ‘C:\location\x\y\z\mydriver\objfre_wxp_x86\i386\base_functionality.obj’

I want to build all the c files (from 2 different src directories) and put all the resultant obj files in the same directory, then link those for mydriver.sys.

Thanks for any help

PS: I want different source directories because I’m making several similar drivers, only a small part changes between each. That’s why most of the code is in base_functionality.c and just a little goes into extended_functionality.c

Welcome to BUILD. You can’t directly reference source in directories other than the current directory. Your choices are:

  1. Build a library in driver common. Put a DIRS at the top of your tree so you build your library and driver directories with one build command if you want.
  2. Create a common.c file in your driver directory and include the c file(s) from your common directory.

> SOURCES=extended_functionality.rc \

extended_functionality.c \
$(OTHER_SRC_DIR)\base_functionality.c

This is not supported.

You must have a SOURCES file with TARGETTYPE=LIBRARY in all dirs but one (but master) to build the dir’s .C and .CPP files to a .LIB.

Then master dir’s SOURCES then uses these LIBs to build the binary.

Use DIRS files to reference all these dirs with SOURCES.


Maxim S. Shatskih
Windows DDK MVP
xxxxx@storagecraft.com
http://www.storagecraft.com

Thank you both for the help (and a blazingly quick reply from Jeff!).

I just #included the c file because that got me on my way in the last time. Perhaps later I will move to using DIRS, if the current method is cumbersom.e