From 047544a5af9100ec269e9222213385bc7794f619 Mon Sep 17 00:00:00 2001 From: Nicholas Tay Date: Sat, 7 May 2022 23:26:27 +1000 Subject: Split out platform-specific code for Windows Not sure if I'm really doing it in the best way possible. Feels a bit weird that some place assumes the existence of other functions. --- Makefile | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Makefile') 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 -- cgit