diff --git a/Makefile b/Makefile index 8c78e6e..3efbdb3 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,27 @@ -# cobbled together really fast -CC = gcc +# Assume Linux/UNIX by default, detect native Windows vs. Cygwin/MSYS2. +# For Clang: CC=clang make -# no matter how hard I try, I can't get make to accept that I'm on windows. -ifneq ($(shell echo),) - DOTEXE=.exe +BINARY=asm6f +RM=rm -f + +ifeq ($(OS),Windows_NT) + BINARY=asm6f.exe + RM=del /Q /F + ifeq ($(OSTYPE),cygwin) + RM=rm -f + else ifdef MSYSTEM + RM=rm -f + endif endif -.PHONY: all clean +CFLAGS=-O2 -Wall -Werror -Wextra -Wformat=2 -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal -Winline -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith -Wredundant-decls -Wstrict-prototypes -Wunreachable-code -Wwrite-strings + +.PHONY: all safe clean all: safe -safe: - $(CC) -Wall asm6f.c -o asm6f +safe: asm6f.c + $(CC) $(CFLAGS) -o $(BINARY) $^ -# sorry to linux people for forcing .exe but I can't get this makefile to determine -# that I'm really on windows clean: - $(RM) asm6f$(DOTEXE) *.exe + $(RM) $(BINARY)