Changed makefile to compile all .c and .h files in the directory and .gitignore to ignore generated .o and .d files
This commit is contained in:
@@ -1,12 +1,24 @@
|
||||
CFLAGS= -Wall -Wextra -O3
|
||||
LDLIBS = -lm
|
||||
CC = gcc
|
||||
CFLAGS = -Wall -Wextra -O3 -std=c17
|
||||
DEPFLAGS = -MMD -MP
|
||||
LDFLAGS = -lm
|
||||
|
||||
TARGET = tricorn
|
||||
SRCS = $(wildcard *.c)
|
||||
OBJS = $(SRCS:.c=.o)
|
||||
DEPS = $(SRCS:.c=.d)
|
||||
|
||||
.PHONY: all clean
|
||||
|
||||
all: tricorn
|
||||
all: $(TARGET)
|
||||
|
||||
$(TARGET): $(OBJS)
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
||||
|
||||
%.o: %.c
|
||||
$(CC) $(CFLAGS) $(DEPFLAGS) -c $< -o $@
|
||||
|
||||
-include $(DEPS)
|
||||
|
||||
tricorn: main.c tricorn.c
|
||||
$(CC) $(CFLAGS) -o $@ $^ $(LDLIBS)
|
||||
clean:
|
||||
rm -f tricorn
|
||||
rm -f $(OBJS) $(DEPS) $(TARGET)
|
||||
Reference in New Issue
Block a user