42 lines
1.1 KiB
Makefile
42 lines
1.1 KiB
Makefile
CC?=gcc
|
|
LD?=ld
|
|
SHROOMSFLAGS=shrooms-vb-core/core/vb.c -I shrooms-vb-core/core
|
|
SDL2FLAGS=$(shell pkg-config sdl2 --cflags --libs) -mconsole
|
|
|
|
.PHONY: clean build
|
|
clean:
|
|
@rm -rf shrooms-vb output
|
|
|
|
CFILES := $(foreach dir,./,$(notdir $(wildcard $(dir)/*.c)))
|
|
BINFILES := $(foreach dir,assets/,$(notdir $(wildcard $(dir)/*.bin)))
|
|
|
|
COBJS := $(CFILES:%.c=output/%.o)
|
|
SHROOMSOBJS := output/vb.o
|
|
BINOBJS := $(BINFILES:%.bin=output/%.o)
|
|
|
|
OFILES := $(COBJS) $(SHROOMSOBJS) $(BINOBJS)
|
|
|
|
output/%.o: %.c
|
|
@mkdir -p output
|
|
@$(CC) -c -o $@ $< -I . \
|
|
-I shrooms-vb-core/core $(SDL2FLAGS) \
|
|
-D _POSIX_C_SOURCE=199309L \
|
|
-O3 -flto -fno-strict-aliasing \
|
|
-Werror -std=c11 -Wall -Wextra -Wpedantic
|
|
|
|
output/vb.o: shrooms-vb-core/core/vb.c
|
|
@mkdir -p output
|
|
@$(CC) -c -o $@ $< -I . \
|
|
-I shrooms-vb-core/core $(SDL2FLAGS) \
|
|
-D _POSIX_C_SOURCE=199309L \
|
|
-O3 -flto -fno-strict-aliasing \
|
|
-Werror -std=c11 -Wall -Wextra -Wpedantic
|
|
|
|
output/%.o: assets/%.bin
|
|
@mkdir -p output
|
|
@$(LD) -r -b binary -o $@ $<
|
|
|
|
shrooms-vb: $(OFILES)
|
|
@$(CC) -o $@ $(OFILES) $(SDL2FLAGS) -flto
|
|
|
|
build: shrooms-vb |