Alex Gray
Alex Gray

Reputation: 71

makefile compile with gcc UNIX

Trying to make makefile to turn all .c into execute files in directory. For example:

am.c
2.c
s.c

into

am
2
s 

programs.

Anything works,but it uses cc, but I want to use gcc compiler. How can I do that?

SRC = $(wildcard *.c)
BIN = $(patsubst %.c,%,$(SRC))

all : $(BIN)

Upvotes: 0

Views: 935

Answers (1)

unxnut
unxnut

Reputation: 8839

Add a line to the top saying

CC = gcc

Upvotes: 1

Related Questions