aboutsummaryrefslogtreecommitdiff
path: root/Makefile
blob: e21da87a5f65420885a570c639dd0cf099241719 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
NAME = clak
PREFIX = $(HOME)/.local

CC = clang
CFLAGS += -std=c99 -Wall -Wextra -Wshadow -Werror

ifeq ($(OS),Windows_NT)
	LDLIBS = -lWinmm
	PLATFORM = win32
else
	UNAME_S := $(shell uname)
	ifeq ($(UNAME_S),Linux)
		PLATFORM = linux
		PKG_CONF_LIBS = sdl2 SDL2_mixer x11 xi
		CFLAGS += `pkg-config --cflags $(PKG_CONF_LIBS)`
		LDLIBS += `pkg-config --libs $(PKG_CONF_LIBS)`
	else ifeq ($(UNAME_S),Darwin)
		PLATFORM = darwin
		CFLAGS += -framework CoreFoundation -framework IOKit -framework AppKit
	endif
endif

default: $(NAME)

$(NAME): $(NAME).c platform/$(PLATFORM).c
	$(CC) $(CFLAGS) $(NAME).c platform/$(PLATFORM).c $(LDLIBS) -o $(NAME)

clean:
	rm -f *.o
	rm -f $(NAME)