Makefile 914 Bytes
Newer Older
Mans Rullgard's avatar
Mans Rullgard committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
ARCH ?= $(shell uname -m)
-include $(or $(CONFIG),$(ARCH)).mk

MAKEFLAGS += -r

O ?= $(ARCH)
override O := $(O:%=$(O:%/=%)/)

SYSROOT = $(addprefix --sysroot=,$(ROOT))

CC = $(CROSS_COMPILE)gcc $(SYSROOT)
AR = $(CROSS_COMPILE)ar

LDLIBS-$(HAVE_BLUOS_SSC) += -lbluos_ssc

CPPFLAGS += -MMD
CFLAGS = -O2 -g -Wall $(CPUFLAGS)
LDFLAGS += -Wl,--as-needed
LDLIBS += -lsndfile $(LDLIBS-y)

ALL = mqascan mqbgen mqbscan
ALL-$(HAVE_BLUOS_SSC) += mqadec mqarender

ALL += $(ALL-y)
ALL := $(ALL:%=$(O)%)
all: $(ALL)

28
LIBOBJ = bits.o blake2s-ref.o mqa-common.o mqa-keys.o mqbcrc.o sfbits.o
Mans Rullgard's avatar
Mans Rullgard committed
29 30 31 32 33 34 35 36 37 38
LIBOBJ := $(LIBOBJ:%=$(O)%)

LIB = $(O)libmqa.a

$(LIB): $(LIBOBJ)
	$(RM) $@
	$(AR) rcs $@ $^

$(ALL): $(LIB)

39 40
$(O)mqascan: LDLIBS += -lgmp

Mans Rullgard's avatar
Mans Rullgard committed
41 42 43 44 45 46 47 48 49 50 51 52 53
$(O)%.o: %.c | $(O)
	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<

$(O)%: $(O)%.o
	$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)

$(O):
	@mkdir -p $@

.PHONY: all
.SECONDARY:

-include $(ALL:%=%.d) $(OBJ:.o=.d)