0

currently I'm using this command to compile my .c files in Mint

gcc -std=gnu99 -Wall -Werror filename.c -o filename [-lm]

How do I make these parameters default, perhaps include them in the make filename.c command? Thanks :)

icedtrees
  • 6,134
  • 5
  • 25
  • 35
user3395711
  • 39
  • 1
  • 9
  • 1
    A quick option if you didn't want to write a makefile: `alias mygcc='gcc -std=gnu99 -Wall -Werror '` – M.M Mar 08 '14 at 10:13

1 Answers1

1

You need to write makefile like

CC = gcc

EXEC = filename

OBJS =  filename.o \

FLAGS = -std=gnu99 -Wall -Werror

LDLIBS = -lm

all: $(EXEC)

$(EXEC): $(OBJS)
    $(CC) $(FLAGS) -o $@ $(OBJS) $(LDLIBS)

clean:
    -rm -f $(EXEC) *.o

Then run make to compile your file

Rahul R Dhobi
  • 5,668
  • 1
  • 29
  • 38