Daniel Serrano
Daniel Serrano

Reputation: 23

Make makefile executable

So, I've built my makefile and it works well, but I still need to type ./escalunador (My program name) to run it, how do I include that in my makefile?

CC = gcc  
CFLAGS = -g -Wall -std=c99

all: escalunador

escalunador: escalunador.o usables.o queue.o linkedlist.o  
    $(CC) $(CFLAGS) -o escalunador escalunador.o usables.o queue.o linkedlist.o

escalunador.o: escalunador.c usables.h queue.h linkedlist.h  
    $(CC) $(CFLAGS) -c escalunador.c

usables.o: usables.c queue.h linkedlist.h  
    $(CC) $(CFLAGS) -c usables.c

queue.o: queue.c linkedlist.h  
    $(CC) $(CFLAGS) -c queue.c

linkedlist.o: linkedlist.c linkedlist.h  
    $(CC) $(CFLAGS) -c linkedlist.c

clean:   
    $(RM) escalunador *.p *~

Upvotes: 0

Views: 44

Answers (1)

uzsolt
uzsolt

Reputation: 6037

Very simple:

run: escalunador
  ./escalunador

.PHONY: run

And maybe you want to modify all: ./escalunador to all: run.

Upvotes: 1

Related Questions