aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile15
1 files changed, 12 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index c2a94a6..bd016b7 100644
--- a/Makefile
+++ b/Makefile
@@ -5,14 +5,23 @@ BOARDS = mxblue quack
CC = gcc
CFLAGS += -std=c99 -Wall -Wextra -Wshadow -Werror -pedantic
-LDLIBS = -lWinmm
BOARD_FILES = $(addsuffix /board.h,$(addprefix board/,$(BOARDS)))
+ifeq ($(OS),Windows_NT)
+ LDLIBS = -lWinmm
+ PLATFORM = win32
+else
+ UNAME_S := $(shell uname)
+ ifeq ($(UNAME_S),Linux)
+ PLATFORM = linux
+ endif
+endif
+
default: $(NAME)
-$(NAME): $(NAME).c $(BOARD_FILES) board/boards.h
- $(CC) $(CFLAGS) $(NAME).c $(LDLIBS) -o $(NAME)
+$(NAME): $(NAME).c platform/$(PLATFORM).c $(BOARD_FILES) board/boards.h
+ $(CC) $(CFLAGS) $(NAME).c platform/$(PLATFORM).c $(LDLIBS) -o $(NAME)
board/boards.h:
printf "#ifndef BOARD_DEFAULTS_H\n#define BOARD_DEFAULTS_H\n\n" > board/boards.h