| 1 | # CC = cc |
| 2 | CC = tcc |
| 3 | CFLAGS = -Wall -std=c99 -D_DEFAULT_SOURCE -O2 |
| 4 | TARGET = moosicpalyer |
| 5 | PREFIX ?= /usr/local |
| 6 | |
| 7 | X_INCLUDES = -Ix11/raylib/include |
| 8 | X_LDFLAGS = -Lx11/raylib -lraylib -lGL -lm -lpthread -ldl -lX11 |
| 9 | |
| 10 | WL_INCLUDES = -Iwayland/raylib/include |
| 11 | WL_LDFLAGS = -Lwayland/raylib -lraylib -lwayland-client -lwayland-cursor -lwayland-egl -lxkbcommon -lGL -lm -lpthread -ldl |
| 12 | |
| 13 | .PHONY: all x11 wayland clean install run |
| 14 | |
| 15 | all: |
| 16 | @echo "run make x11 or make wayland" |
| 17 | |
| 18 | x11: CFLAGS += $(X_INCLUDES) |
| 19 | x11: LDFLAGS = $(X_LDFLAGS) |
| 20 | x11: $(TARGET)-x11 |
| 21 | |
| 22 | wayland: CFLAGS += $(WL_INCLUDES) |
| 23 | wayland: LDFLAGS = $(WL_LDFLAGS) |
| 24 | wayland: $(TARGET)-wayland |
| 25 | |
| 26 | $(TARGET)-x11: x11/main.c |
| 27 | $(CC) x11/main.c -o $(TARGET) $(CFLAGS) $(LDFLAGS) |
| 28 | |
| 29 | $(TARGET)-wayland: wayland/main.c |
| 30 | $(CC) wayland/main.c -o $(TARGET) $(CFLAGS) $(LDFLAGS) |
| 31 | |
| 32 | clean: |
| 33 | rm -f $(TARGET) |
| 34 | |
| 35 | install: $(TARGET) |
| 36 | install -Dm755 $(TARGET) $(PREFIX)/bin/$(TARGET) |
| 37 | install -Dm644 x11/moosicpalyer.desktop $(PREFIX)/share/applications/moosicpalyer.desktop |
| 38 | |
| 39 | run: $(TARGET) |
| 40 | ./$(TARGET) |