Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

:= or += when compiling Linux kernel modules?

Tutorials for compiling the kernel module for Linux, use different syntax for the Makefile.

Example 1

obj-m += rpi-pwm.o 

Example 2

obj-m := nothing.o

What are the differences, and is there a preferred way?

like image 735
TheMeaningfulEngineer Avatar asked Sep 25 '26 20:09

TheMeaningfulEngineer


1 Answers

:= would set the variable obj-m to nothing.o. This implies that if obj-m was previously set then it would be replaced by nothing.o.

+= would add rpi-pwm.o to the variable obj-m. If obj-m was previously set to nothing.o, then it'd become nothing.o rpi-pwm.o.

Saying

obj-m += rpi-pwm.o

is equivalent to saying

obj-m := $(obj-m) rpi-pwm.o
like image 108
devnull Avatar answered Sep 28 '26 12:09

devnull



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!