Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Makefile with flags

    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
    make -C $(KERNELPATH) M=$(PWD) modules
    make -C $(KERNELPATH) M=$(PWD) clean

  2. #2
    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