Find the answer to your Linux question:
Results 1 to 2 of 2
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 ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2009
    Posts
    1

    Makefile with flags


    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:

    Code:
    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

  2. #2
    Just Joined!
    Join Date
    Feb 2008
    Posts
    17
    This is usually how I do it. (Note that I might not be doing it in a perfect way.

    make -C $(KERNELPATH) M=$(PWD) CFLAGS_MODULE="-Drelease_flag" modules

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •