freepassport-c/Makefile

45 lines
1.3 KiB
Makefile
Raw Permalink Normal View History

2026-03-27 21:45:40 -04:00
CC ?= cc
CSTD ?= -std=c11
CFLAGS ?= -O2 -Wall -Wextra -Wpedantic $(CSTD)
2026-03-30 12:09:11 -04:00
CFLAGS += -MMD -MP
2026-03-27 21:45:40 -04:00
2026-03-29 14:43:18 -04:00
SDL_CFLAGS := $(shell pkg-config --cflags SDL2 SDL2_ttf SDL2_image 2>/dev/null)
SDL_LIBS := $(shell pkg-config --libs SDL2 SDL2_ttf SDL2_image 2>/dev/null)
FFMPEG_CFLAGS := $(shell pkg-config --cflags libavformat libavcodec libswscale libswresample libavutil 2>/dev/null)
FFMPEG_LIBS := $(shell pkg-config --libs libavformat libavcodec libswscale libswresample libavutil 2>/dev/null)
2026-03-27 21:45:40 -04:00
MULTIARCH_CFLAGS := $(if $(wildcard /usr/include/i386-linux-gnu/SDL2/_real_SDL_config.h),-I/usr/include/i386-linux-gnu,)
ifeq ($(strip $(SDL_CFLAGS)),)
SDL_CFLAGS := $(shell sdl2-config --cflags 2>/dev/null) $(MULTIARCH_CFLAGS)
2026-03-29 14:43:18 -04:00
SDL_LIBS := $(shell sdl2-config --libs 2>/dev/null) -lSDL2_ttf -lSDL2_image
2026-03-27 21:45:40 -04:00
endif
ifeq ($(strip $(FFMPEG_LIBS)),)
FFMPEG_LIBS := -lavformat -lavcodec -lswscale -lswresample -lavutil
2026-03-27 21:45:40 -04:00
endif
SRC := $(wildcard src/*.c)
OBJ := $(SRC:.c=.o)
2026-03-30 12:09:11 -04:00
DEP := $(OBJ:.o=.d)
2026-03-27 21:45:40 -04:00
BIN := passport-c-media-player
CPPFLAGS += -I./src $(SDL_CFLAGS) $(FFMPEG_CFLAGS)
LDLIBS += $(SDL_LIBS) $(FFMPEG_LIBS) -lm
2026-03-28 15:20:18 -04:00
.PHONY: all run clean appimage
2026-03-27 21:45:40 -04:00
all: $(BIN)
$(BIN): $(OBJ)
$(CC) $(OBJ) -o $@ $(LDLIBS)
2026-03-30 12:09:11 -04:00
-include $(DEP)
2026-03-27 21:45:40 -04:00
run: $(BIN)
./$(BIN)
clean:
rm -f $(OBJ) $(BIN)
2026-03-28 15:20:18 -04:00
appimage: $(BIN)
./build-appimage.sh