aboutsummaryrefslogblamecommitdiff
path: root/Makefile
blob: ce7e806069737c376ef1beaf9d81d515dbcfe9c7 (plain) (tree)
1
2
3
4
5
6
7
8
9


                       
          
                                                 
 
                       

                        
    


                                 


                                                                


                                                                                      
                                                           
             
     
                                    
 

                

                                                                    
 

                 
                     
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
		PLATFORM_C += platform/$(PLATFORM)-native.m
	endif
endif
PLATFORM_C += platform/$(PLATFORM).c

default: $(NAME)

$(NAME): $(NAME).c $(PLATFORM_C)
	$(CC) $(CFLAGS) $(NAME).c $(PLATFORM_C) $(LDLIBS) -o $(NAME)

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