1# Project: SDLPoP
2
3CC = gcc
4RM = rm -f
5
6HFILES = common.h config.h data.h proto.h types.h
7OBJ = main.o data.o seg000.o seg001.o seg002.o seg003.o seg004.o seg005.o seg006.o seg007.o seg008.o seg009.o seqtbl.o replay.o options.o lighting.o screenshot.o menu.o midi.o opl3.o stb_vorbis.o
8BIN = ../prince
9
10OS      := $(shell uname)
11
12CPPFLAGS += -Wall -D_GNU_SOURCE=1
13CFLAGS += -std=gnu99 -O2
14
15ifeq ($(OS),Darwin)
16LIBS := $(shell sdl2-config --libs) -lSDL2_image
17CFLAGS += -I/opt/local/include
18CPPFLAGS += -D_THREAD_SAFE -DOSX
19else
20LIBS := $(shell pkg-config --libs   sdl2 SDL2_image)
21CFLAGS += $(shell pkg-config --cflags sdl2 SDL2_image)
22endif
23
24all: $(BIN)
25
26clean:
27	$(RM) $(OBJ) $(BIN)
28
29install:
30	./install.sh
31
32uninstall:
33	./uninstall.sh
34
35$(BIN): $(OBJ)
36	$(CC) $(LDFLAGS) $(OBJ) -o $@ $(LIBS) -lm
37
38%.o: %.c $(HFILES)
39	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -c $<
40
41.PHONY: all clean
42
43