c - Makefile: File doesn't exist when the file does exist -
# arquitectura cc := arm-none-eabi- # compiladores gcc :=$(cc)gcc :=$(cc)as libc :=$(cc)ar # linker linker :=$(cc)ld # flags compilação flagdebug :=-g cflags :=-c -mapcs #-wall cdepend :=-mm -mf libflag := rcs ldscript := -t ldlibdir := -l ldliblibs := -l # $@ -> nome alvo .. $^/s? lista de dependencias .. $* contêm o valor de % .. $< contêm primeira dependencia # pastas depdir := depends/ sourcedir := source/ sourcecdir :=$(sourcedir)c/ sourceadir :=$(sourcedir)assembly/ libdir := library/ headdir := header/ objdir := object/ # dependencias sourcec := $(wildcard $(sourcecdir)*.c) sourcea := $(wildcard $(sourceadir)*.s) objc :=$(patsubst $(sourcecdir)%.c,%.o,$(sourcec)) obja :=$(patsubst $(sourceadir)%.s,%.o,$(sourcea)) header :=$(wildcard $(headdir)*.h) libl = $(wildcard $(libdir)*.a) #libl = $(wildcard $(libdir)lib*.a) depend :=$(patsubst %.o,$(depdir)%.d,$(objc)) script := $(wildcard *.ld) lib = # ficheiros de output fichdebug := teste.axf fichrelease := release.axf debug: $(fichdebug) # executável para debug $(fichdebug):$(obja) $(objc) @echo efectuar linkagem dos módulos para gerar o executável $@ @$(linker) $(obja) $(objc) $(ldscript) $(script) -o $@ # compilar ficheiros .s e .c %.o:$(sourceadir)%.s @echo compilar $@ partir de $*.s @$(as) $(flagdebug) $< -o $@ %.o:$(sourcecdir)%.c @echo compilar $@ partir de $*.c $(gcc) $(cdepend) $(patsubst %.o,$(depdir)%.d,$@) $< $(gcc) $(flagdebug) $(cflags) $< -o $@ -include $(depend) release: $(fichrelease) $(fichrelease): $(obja) $(objc) @echo efectuar linkagem dos módulos para gerar o executável $@ @$(linker) $(obja) main.o $(ldscript) $(script) -o $@ $(ldlibdir) $(libdir) $(ldliblibs) # gerar bibliotecas necessárias gerarlib:$(header) @echo $(header) $(headdir)%.h: %.o @echo $@ $* @$(eval lib = $(patsubst $(headdir)%.h,$(libdir)lib%.a,$@)) $(libc) $(libflag) $(lib) $(patsubst $(libdir)lib%.a,%.o,$(lib)) .phony: clean clean: @ rm -rf $(depdir)*.d $(sourcedir)*/*~ *~ *.o $(libdir)*.a *.axf *.o
so heres makefile i'm using. generates code supposed ant updates correctly when file changes(.h or .c), issue dependencies generated not have proper object path set(i've read bug in gcc when writes file dependencies) thought i'd make script adds path , work , i'd able put object files belong(object folder) every time try run make after initial compilation(which works fine btw) gives me erro saying 1 of header files doesn't exist(which untrue since file there , can access it).
anyone have idea of whats happening?(to change between "modes" write $(objdir) before every %.o , *.o)
this rule looks suspicious:
$(headdir)%.h: %.o @echo $@ $* @$(eval lib = $(patsubst $(headdir)%.h,$(libdir)lib%.a,$@)) $(libc) $(libflag) $(lib) $(patsubst $(libdir)lib%.a,%.o,$(lib))
it claims creating .h
files .o
files, seems unlikely, given rules.
Comments
Post a Comment