Make file and build on the terminal

Asked

Viewed 174 times

1

Imagem

I need my Makefile to run on the terminal so that it is not necessary to insert on the terminal $ time make run, and yes only make run, and let it show execution time in the same way. Can someone please help me?

Code of the Make:

NAME=TP1_main2
CC=gcc
TODOS_ARQUIVOS_PONTOH = TP1_main2.c 
TODOS_ARQUIVOS_OBJ = $(NAME).o TP1_main2.o

%.o: %.c $(TODOS_ARQUIVOS_PONTOH)
    $(CC) -o $@ -c $< $(OPCOES_COMPILADOR)

all: $(TODOS_ARQUIVOS_OBJ)
    gcc -o $(NAME) $^ $(OPCOES_COMPILADOR)

run: all
    ./$(NAME)

clean:
    rm *.o $(NAME)
  • How long do you want to register? From build or just run?

  • Taking advantage, it is better if you post the Makefile code, it is better to copy and paste in the reply

  • I want to record the entire time of the process. And thanks for the tip on make, the next times I will do it this way.

  • Unfortunately, the directive time records the time of a past command. If you want all the make, it is correct to do just that. It is even possible to make a recursive call to make and by the time there, but this is apparently gambitic

  • It is always a good directive to put the doubt code here in the SO-en

  • Thanks, you’ve helped enough.

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.