Connecting Tech Pros Worldwide Help | Site Map

Makefile with flags

Newbie
 
Join Date: Oct 2006
Posts: 6
#1: Jan 26 '09
Hi,
Small question regarding makefiles:
I want to add a new target: release
that will compile my driver with additional flag
(EXTRA_CFLAGS += -Drelease_flag)

how can i do that on this example:


KERNELPATH := /home/kernel-2.6.24/

.PHONY: all clean
EXTRA_CFLAGS += -Werror
EXTRA_CFLAGS += -I$(src)/dir1
EXTRA_CFLAGS += -I$(src)/dir2

all: modules
obj-m := driver.o
driver-objs := file1.o
driver-objs += file2.o

modules:
make -C $(KERNELPATH) M=$(PWD) modules

clean:
make -C $(KERNELPATH) M=$(PWD) clean

thanks
ashitpro's Avatar
Expert
 
Join Date: Aug 2007
Posts: 389
#2: Jan 27 '09

re: Makefile with flags


Quote:

Originally Posted by amitbern View Post

Hi,
Small question regarding makefiles:
I want to add a new target: release
that will compile my driver with additional flag
(EXTRA_CFLAGS += -Drelease_flag)

how can i do that on this example:


KERNELPATH := /home/kernel-2.6.24/

.PHONY: all clean
EXTRA_CFLAGS += -Werror
EXTRA_CFLAGS += -I$(src)/dir1
EXTRA_CFLAGS += -I$(src)/dir2

all: modules
obj-m := driver.o
driver-objs := file1.o
driver-objs += file2.o

modules:
make -C $(KERNELPATH) M=$(PWD) modules

clean:
make -C $(KERNELPATH) M=$(PWD) clean

thanks

Can't you do something like this:

release:
make -C $(KERNELPATH) M=$(PWD) -Drelease_flag modules

Regards,
Ash
Newbie
 
Join Date: Oct 2006
Posts: 6
#3: Jan 28 '09

re: Makefile with flags


tried.. not working.. :(
ashitpro's Avatar
Expert
 
Join Date: Aug 2007
Posts: 389
#4: Jan 28 '09

re: Makefile with flags


Quote:

Originally Posted by amitbern View Post

tried.. not working.. :(

What error does it gives?
First of all make sure whether that "make" (after release) is valid.
You can put "echo" statements inside release, so that you can debug the make file..

Regards,
Ash
Reply