From 51891a61e1a5e3f270cb585d0b3dc20794039464 Mon Sep 17 00:00:00 2001 From: Gustav Louw Date: Sun, 23 Sep 2018 12:29:09 -0700 Subject: [PATCH] cleaned up makefile --- Makefile | 62 ++++++++++---------------------------------------------- 1 file changed, 11 insertions(+), 51 deletions(-) diff --git a/Makefile b/Makefile index 40382d5..7a2e68b 100644 --- a/Makefile +++ b/Makefile @@ -1,58 +1,18 @@ -# Makefile with support for Windows (mingw32) and NIX (clang / gcc) +BIN = test + +CFLAGS = -std=c99 -Wall -Wextra -pedantic -Ofast -flto + +LDFLAGS = -lm CC = gcc -NAME = tinn +SRC = test.c Tinn.c -SRCS = -SRCS += test.c -SRCS += Tinn.c +all: + $(CC) $(CFLAGS) $(LDFLAGS) $(SRC) -o $(BIN) -# CompSpec defined in windows environment. - -ifdef ComSpec - BIN = $(NAME).exe -else - BIN = $(NAME) -endif - -CFLAGS = -CFLAGS += -std=c99 -CFLAGS += -Wshadow -Wall -Wpedantic -Wextra -Wdouble-promotion -Wunused-result -CFLAGS += -g -CFLAGS += -Ofast -march=native -pipe -CFLAGS += -flto - -LDFLAGS = -LDFLAGS += -lm - -ifdef ComSpec - RM = del /F /Q - MV = ren -else - RM = rm -f - MV = mv -f -endif - -# Link. - -$(BIN): $(SRCS:.c=.o) - $(CC) $(CFLAGS) $(SRCS:.c=.o) $(LDFLAGS) -o $(BIN) - -# Compile. - -%.o : %.c Makefile - $(CC) $(CFLAGS) -MMD -MP -MT $@ -MF $*.td -c $< - $(RM) $*.d - $(MV) $*.td $*.d -%.d: ; --include *.d +run: + ./$(BIN) clean: - $(RM) vgcore.* - $(RM) cachegrind.out.* - $(RM) callgrind.out.* - $(RM) saved.tinn - $(RM) $(BIN) - $(RM) $(SRCS:.c=.o) - $(RM) $(SRCS:.c=.d) + rm -f $(BIN)