EXES := gl_basic simple-x11-egl
CFLAGS += -std=c99 $(shell pkg-config --cflags waffle-1)
LDFLAGS += $(shell pkg-config --libs waffle-1)

ifeq ($(shell uname),Darwin)
    EXES := $(filter-out simple-x11-egl,$(EXES))
    CFLAGS += -ObjC
    LDFLAGS += \
        -framework Cocoa \
        -framework CoreFoundation \
        -framework OpenGL
endif

.PHONY: all
all: $(EXES)

.PHONY: clean
clean:
	-rm $(EXES)

gl_basic: gl_basic.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o gl_basic gl_basic.c

simple-x11-egl: simple-x11-egl.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o simple-x11-egl simple-x11-egl.c
