Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7547415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:26:51+00:00 2026-05-30T09:26:51+00:00

in kernel Makefile # Modules / %/: prepare scripts FORCE $(cmd_crmodverdir) $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)

  • 0

in kernel Makefile

# Modules                                                                                                                                                                               
/ %/: prepare scripts FORCE
    $(cmd_crmodverdir)
    $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
    $(build)=$(build-dir)
%.ko: prepare scripts FORCE
    $(cmd_crmodverdir)
    $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)   \
    $(build)=$(build-dir) $(@:.ko=.o)
    $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost

causing error Makefile mixed implicit and normal rules. (to first string on provided code)

I think something wrong with / %/ syntax, how can I repair it?

so far I’m thinking about separating rules this way:

# Modules                                                                                                                                                                               
/: prepare scripts FORCE
    $(cmd_crmodverdir)
    $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
    $(build)=$(build-dir)
%/: prepare scripts FORCE
    $(cmd_crmodverdir)
    $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) \
    $(build)=$(build-dir)
%.ko: prepare scripts FORCE
    $(cmd_crmodverdir)
    $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1)   \
    $(build)=$(build-dir) $(@:.ko=.o)
    $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost

But it’s confusing for me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:26:52+00:00Added an answer on May 30, 2026 at 9:26 am

    What do you think the / %/ rule is doing (apart from confuse you and make — and me)? What are you trying to achieve with the %/ bit?

    You can have two (or more) targets on the left of the colon, but they both need to be percent-less.

    prog1 prog2: something
        $(CC) -o $@ $@.o ${LIBRARIES}
    

    The % metacharacter cannot be used with a rule without any % in it, but make is interpreting:

    / %/:
    

    as similar to the prog1 prog2 example, but one of the targets has a % and the other does not, and you’re not allowed to mix these up. The / rule is the explicit rule; it appears to be instructions on how to update the root directory of your system. The %/ is the implicit rule; it might be doing something related to making directories up to date.


    Copying some material up from the comments:

    DIRECTORY_BUILD_RULES = \
        $(cmd_crmodverdir); \
        $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) $(build)=$(build-dir)
    
    /:  prepare scripts FORCE; $(DIRECTORY_BUILD_RULES)
    
    %/: prepare scripts FORCE; $(DIRECTORY_BUILD_RULES)
    

    This notation should work (which is why I used it in the comment), but what I’d write in a makefile is:

    DIRECTORY_DEPENDENCIES = prepare scripts FORCE
    DIRECTORY_BUILD_RULES = \
        $(cmd_crmodverdir); \
        $(Q)$(MAKE) KBUILD_MODULES=$(if $(CONFIG_MODULES),1) $(build)=$(build-dir)
    
    /:  $(DIRECTORY_DEPENDENCIES)
        $(DIRECTORY_BUILD_RULES)
    
    %/: $(DIRECTORY_DEPENDENCIES)
        $(DIRECTORY_BUILD_RULES)
    

    If this still causes trouble, review what the first (the /:) rule does. Are you sure it is needed?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

#kernel build system and can use its lanauge ifneq($(KERNELRELEASE),) obj-m:=helloworld.o else KDIR:= /lib/modules/2.6.33.3-85.fc13.i686/build all:
I am trying to build some kernel modules I added to my Ubuntu source
I am having problems getting any kernel modules to build on my machine. Whenever
I have the following makefile that I use to build a program (a kernel,
I'm trying to compile a linux kernel module using a Makefile: obj-m += main.o
ifeq ($(KBUILD_SRC),) I saw the above in Makefile of linux kernel. It doesn't look
I created the make file obj-m += hello.o all: make -C /home/developer/Desktop/xukr-20120201-omap3/linux-2.6.37-tn M=/home/developer/Desktop/module_test modules
The Linux Kernel Modules (LKM) B depends on Symbols provided by LKM A. Thus
Is there a way that I can set my kernel Makefile flags to always
I'm cross-compiling kernel modules and some libraries on x86 for ppc. Is it possible

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.