2 # get the type of OS currently running
3 OS=$(shell uname)
5 # check if the OS string contains 'Linux'
6 ifneq (,$(findstring Linux, $(OS)))
7 # Linux OS...
8 APP_EXT=
9 CLEAN=rm -f
10 else
11 # windows OS...
12 APP_EXT=.exe
13 CLEAN=del
14 endif
16 CCOVERRIDE ?= $(CC)
18 SRCS = $(wildcard *.c)
19 EXES = $(patsubst %.c,%$(APP_EXT),$(SRCS))
21 .PHONY: all clean
22 all: $(EXES)
24 clean:
25 $(CLEAN) $(EXES)
27 %$(APP_EXT): %.c
28 $(CCOVERRIDE) $(CFLAGS) -o $@ $<