c - Makefile - wrong sequence of compiling -


in makefile below i'm trying compile 1 directory, make against trying in wrong order. it's starting compiling main.o , later goes straight compiling console. have no idea why it's not trying solve dependences before it. get:

user@ubuntu:~/dokumenty/sysopy/cw1/zad3b$ make  gcc -c -wall -i ./src/include src/main.c  gcc  -o macierze main.o  main.o: in function `main':  main.c:(.text+0x28): undefined reference `wczytaj'  main.c:(.text+0x31): undefined reference `wczytaj'  main.c:(.text+0x7e): undefined reference `suma'  ... collect2: ld returned 1 exit status make: *** [console] błąd 1 

here's makefile:

############ makra ############# cc = gcc cflags = -wall -i ./src/include lflags =  vpath = ./src/operacje: ./src/we_wy: ./src/reszta  ########### pliki ############## src_console = wczytaj_konsola.c wypisz_konsola.c src_file        = wczytaj_plik.c wypisz_plik.c pliki.c src_function    = suma.c roznica.c iloczyn.c macierz.c headers     = suma.h roznica.h iloczyn.h wypisz.h wczytaj.h macierz.h obj_sonsole = $(src_console:.c=.o) obj_file    = $(src_file:.c=.o) obj_function    = $(src_functions:.c=.o)   console: $(obj_console) $(obj_function) main.o      $(cc) $(lflags) -o macierze $^  file: $(obj_file) $(obj_function) main.o     $(cc) $(lflags) -o macierze $^   console_logs: $(obj_console) $(obj_function) main.o     $(cc) $(lflags) -o macierze $^  file_logs: $(obj_file) $(obj_function) main.o     $(cc) $(lflags) -o macierze $^  ############# objekty ############## main.o:     $(cc) -c $(cflags) src/main.c  $(obj_console): $(src_console)      $(cc) -c $(cflags) $^  $(obj_file): $(src_file)      $(cc) -c $(cflags) $^  $(obj_function): $(src_function)      $(cc) -c $(cflags) $^    %logs   : lflags += -d komunikaty file%   : lflags += -d pliki  ./phony: clean clean:     rm -f *.o     rm -f ./src/include/*.gch     rm -f macierze 

you write : obj_function = $(src_functions:.c=.o) instead of : obj_function = $(src_function:.c=.o)

and

obj_sonsole = $(src_console:.c=.o) instead of obj_console = $(src_console:.c=.o)


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -