Thread: makefile targets when using sub make instance/s

  1. #1
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733

    makefile targets when using sub make instance/s

    I got this:
    Code:
    default: force
    	cd ../ && make $(MAKEFILES)
    %: default
    force: ;
    Running make without targets gives the expected result but when I try with targets (such as "make test") it gives me this:
    Code:
    make test (in directory: ~/mitsy/include/mcc/core)
    make: *** No rule to make target 'test'.  Stop.
    Compilation failed.
    Any ideas?
    FYI the final makefile looks like this:
    Code:
    INC_PATHS=../include
    IS_WINDOWS:=$(if $(Program Files),1,)
    IS_WIN64:=$(if ${Program Files(x86)},1,)
    IS_WIN32:=$(if $(IS_WIN64),,$(IS_WINDOWS))
    EXE?=$(if $(IS_WINDOWS),exe,AppImage)
    IFLAGS:=$(INC_PATHS:%=-I %)
    CFLAGS:=-Wall $(IFLAGS)
    
    mcc: mcc_core.so
    test: mcc_core.so test.$(EXE)
    mcc_core.so: mcc_get.c mcc_mem.c mcc_vint.c mcc_vflt.c
    test.AppImage: test/unit_tests.o
    
    mcc_vflt.c: mcc/core/vflt.h
    mcc_vint.c: mcc/core/vint.h
    mcc_get.c: mcc/core/get.h
    mcc_mem.c: mcc/core/mem.h
    mcc/core/vflt.h: mcc/core/vint.h
    mcc/core/vint.h: mcc/core/get.h
    mcc/core/get.h: mcc/core/mem.h
    mcc/core/mem.h: mcc/malloc.h
    mcc/malloc.h: mcc/vmalloc.h
    mcc/vmalloc.h: mcc/inttypes.h
    mcc/inttypes.h: mcc/stdint.h
    mcc/stdint.h: mcc/limits.h
    mcc/limits.h: mcc/core/sys.h
    mcc/core/sys.h:
    test/unit_tests.o: test/unit_tests.c
    test/unit_tests.c: test/core/vint.c
    
    %.o: %.c
    	clang $(CFLAGS) -o $@ $<
    
    force: ;

  2. #2
    Registered User awsdert's Avatar
    Join Date
    Jan 2015
    Posts
    1,733
    Never mind, after finding this and hunting around in it for variables I came up with this:
    Code:
    %: force
    	cd ../ && make $(MAKEFILES) $(MAKECMDGOALS)
    force: ;
    Which is working fine for me

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 10-05-2016, 12:15 PM
  2. Makefile for similar targets
    By King Mir in forum Tech Board
    Replies: 6
    Last Post: 11-26-2011, 07:11 AM
  3. Replies: 2
    Last Post: 04-27-2011, 04:14 PM
  4. Can't make sense of the makefile
    By bhram_cs in forum C Programming
    Replies: 17
    Last Post: 08-11-2010, 05:15 AM
  5. make incorrectly remaking targets
    By jarro_2783 in forum C Programming
    Replies: 4
    Last Post: 05-26-2006, 12:10 AM

Tags for this Thread