cleaned up makefile

This commit is contained in:
Gustav Louw 2018-09-23 12:29:09 -07:00
parent 20622df254
commit 51891a61e1
1 changed files with 11 additions and 51 deletions

View File

@ -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 CC = gcc
NAME = tinn SRC = test.c Tinn.c
SRCS = all:
SRCS += test.c $(CC) $(CFLAGS) $(LDFLAGS) $(SRC) -o $(BIN)
SRCS += Tinn.c
# CompSpec defined in windows environment. run:
./$(BIN)
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
clean: clean:
$(RM) vgcore.* rm -f $(BIN)
$(RM) cachegrind.out.*
$(RM) callgrind.out.*
$(RM) saved.tinn
$(RM) $(BIN)
$(RM) $(SRCS:.c=.o)
$(RM) $(SRCS:.c=.d)