<commit_before>UNAME := $(shell uname)

CC = gcc
CFLAGS=-Wall -O2 -D$(UNAME)

CFLAGS_Linux=-Wno-unused-result -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast

LD = gcc
LDFLAGS=

TARGET=tikitank

EFFECT=effects
PAL=pal/$(UNAME)

SRCDIR=src
OBJDIR=obj
BINDIR=bin

LIBS_Linux=-lrt
LIBS=-lpthread

COMMON_SRC := $(wildcard $(SRCDIR)/*.c)
COMMON_INC := $(wildcard $(SRCDIR)/*.h)
COMMON_OBJ := $(COMMON_SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)

EFFECT_SRC := $(wildcard $(SRCDIR)/$(EFFECT)/*.c)
EFFECT_INC := $(wildcard $(SRCDIR)/$(EFFECT)/*.h)
EFFECT_OBJ := $(EFFECT_SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)

PAL_SRC := $(wildcard $(SRCDIR)/$(PAL)/*.c)
PAL_INC := $(wildcard $(SRCDIR)/$(PAL)/*.h)
PAL_OBJ := $(PAL_SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)

# pasm -V3 -b firmware.p firmware => firmware.bin

# TODO: Add CFLAGS=-mtune=cortex-a8 -march=armv7-a -O3

.PHONY: all clean

all: $(BINDIR)/$(TARGET)

$(BINDIR)/$(TARGET): $(COMMON_OBJ) $(EFFECT_OBJ) $(PAL_OBJ)
	$(LD) $(LDFLAGS) -o $@ $(COMMON_OBJ) $(EFFECT_OBJ) $(PAL_OBJ) $(LIBS) $(LIBS_$(UNAME))

$(COMMON_OBJ): | $(OBJDIR)
$(EFFECT_OBJ): | $(OBJDIR)/$(EFFECT)
$(PAL_OBJ):    | $(OBJDIR)/$(PAL)

$(OBJDIR):
	@mkdir -p $@

$(OBJDIR)/$(EFFECT):
	@mkdir -p $@

$(OBJDIR)/$(PAL):
	@mkdir -p $@

$(BINDIR)/$(TARGET) : | $(BINDIR)

$(BINDIR):
	@mkdir -p $@

$(COMMON_OBJ): $(OBJDIR)/%.o : $(SRCDIR)/%.c $(COMMON_INC)
	$(CC) $(CFLAGS) -c -o $@ $<
<commit_msg>Compile pru fw when building on bbb<commit_after>UNAME := $(shell uname)

PASM := $(shell which pasm)

CC = gcc
CFLAGS=-Wall -O2 -D$(UNAME)

CFLAGS_Linux=-Wno-unused-result -Wno-int-to-pointer-cast -Wno-pointer-to-int-cast

LD = gcc
LDFLAGS=

TARGET=tikitank

EFFECT=effects
PAL=pal/$(UNAME)

SRCDIR=src
OBJDIR=obj
BINDIR=bin

LIBS_Linux=-lrt
LIBS=-lpthread

COMMON_SRC := $(wildcard $(SRCDIR)/*.c)
COMMON_INC := $(wildcard $(SRCDIR)/*.h)
COMMON_OBJ := $(COMMON_SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)

EFFECT_SRC := $(wildcard $(SRCDIR)/$(EFFECT)/*.c)
EFFECT_INC := $(wildcard $(SRCDIR)/$(EFFECT)/*.h)
EFFECT_OBJ := $(EFFECT_SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)

PAL_SRC := $(wildcard $(SRCDIR)/$(PAL)/*.c)
PAL_INC := $(wildcard $(SRCDIR)/$(PAL)/*.h)
PAL_OBJ := $(PAL_SRC:$(SRCDIR)/%.c=$(OBJDIR)/%.o)

# pasm -V3 -b firmware.p firmware => firmware.bin

# TODO: Add CFLAGS=-mtune=cortex-a8 -march=armv7-a -O3

.PHONY: all clean

all: $(BINDIR)/$(TARGET)

$(BINDIR)/$(TARGET): $(COMMON_OBJ) $(EFFECT_OBJ) $(PAL_OBJ)
	$(LD) $(LDFLAGS) -o $@ $(COMMON_OBJ) $(EFFECT_OBJ) $(PAL_OBJ) $(LIBS) $(LIBS_$(UNAME))

ifneq ($(strip $(PASM)),)

all: | $(BINDIR)/firmware.bin

$(BINDIR)/firmware.bin: $(SRCDIR)/$(PAL)/firmware.p
	$(PASM) -V3 -b $< $(basename $@)

endif

$(COMMON_OBJ): | $(OBJDIR)
$(EFFECT_OBJ): | $(OBJDIR)/$(EFFECT)
$(PAL_OBJ):    | $(OBJDIR)/$(PAL)

$(OBJDIR):
	@mkdir -p $@

$(OBJDIR)/$(EFFECT):
	@mkdir -p $@

$(OBJDIR)/$(PAL):
	@mkdir -p $@

$(BINDIR)/$(TARGET) : | $(BINDIR)

$(BINDIR):
	@mkdir -p $@

$(COMMON_OBJ): $(OBJDIR)/%.o : $(SRCDIR)/%.c $(COMMON_INC)
	$(CC) $(CFLAGS) -c -o $@ $<

{'fraction_non_alphanumeric': 0.26639757820383453, 'fraction_numerical': 0.003699966363942146, 'mean_word_length': 4.785992217898833, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5761515', 'n_tokens_mistral': 1464, 'n_tokens_neox': 1396, 'n_words': 226}