<commit_before># Program name
PROGRAM = florb

# Check if prefix is defined
if $(not $(defined PREFIX))
	PREFIX = /usr
	export

# Absolute path for prefix
PREFIX = $(absname $(PREFIX))

# Compiler and linker flags
CXX = $(shell fltk-config --cxx)
CXXFLAGS = -g -Wall -O2 -funroll-loops -DPREFIX=\"$(PREFIX)\" \
    $(shell fltk-config --use-images --cxxflags) \
	$(shell curl-config --cflags) \
	$(shell pkg-config --cflags sqlite3) \
	$(shell pkg-config --cflags tinyxml2) \
	$(shell pkg-config --cflags libgps) \
	$(shell pkg-config --cflags x11) \
	$(shell pkg-config --cflags xpm) \
	$(shell pkg-config --cflags yaml-cpp)
	
LDFLAGS = \
	$(shell fltk-config --use-images --ldflags) \
	$(shell curl-config --libs) \
	$(shell pkg-config --libs sqlite3) \
	$(shell pkg-config --libs tinyxml2) \
	$(shell pkg-config --libs libgps) \
	$(shell pkg-config --libs x11) \
	$(shell pkg-config --libs yaml-cpp) \
	$(shell pkg-config --libs xpm) \
	-lpthread \
	-lboost_system \
    -lboost_filesystem \
    -lboost_thread

# Phony targets
.PHONY: clean install i18nupdate i18ncompile

# Object files to be combined into the program binary. The last line combines
# fluid and regular source objects and eliminates duplicates for when fluid has
# already generated .cpp files.
OBJS_FLUID = $(rootname $(find . -name *.fl))
OBJS_CPP   = $(rootname $(find . -name *.cpp))
OBJS       = $(set $(OBJS_FLUID) $(OBJS_CPP))
#TRANSLATIONS = $(find ./i18n/ -name *.mo)

# Generate version string (version.hpp) from repository information
version.hpp: ../.git/HEAD ../.git/index ./mkversionhpp.sh
    ./mkversionhpp.sh

# Rule for generating CPP code from fluid sources
%.cpp: %.fl
    fluid -c -o $@ -h $(replacesuffixes .cpp, .hpp, $@) $<

# Dependency scanner
.SCANNER: %.o: %.cpp :value: $(digest-in-path-optional $(INCLUDES), $&)
    $(CXX) -MM $(addprefix -I, $(INCLUDES)) $<

# Handle subdirectories
.SUBDIRS: ./fluid
	INCLUDES[] += ../

# Build the program
CGeneratedFiles($(addsuffix .cpp, $(OBJS_FLUID)) version.hpp)
CXXProgram($(PROGRAM), $(OBJS))
.DEFAULT: $(PROGRAM)$(EXE)

# install target
if $(not $(defined PREFIX))
    PREFIX = /usr/local
    export

# Find all translations
TRANSLATIONS =
    foreach(d => ..., $(find ./i18n/ -regex [a-z]{2\,2}_[A-Z]{2\,2}))
		value $(d)

# install target
install:
	mkdir($(PREFIX)/bin/ -p)
	install $(PROGRAM) $(PREFIX)/bin/
	foreach(t => ..., $(basename $(TRANSLATIONS)))
		mkdir -p $(PREFIX)/share/locale/$(t)/LC_MESSAGES/
		install ./i18n/$(t)/florb.mo $(PREFIX)/share/locale/$(t)/LC_MESSAGES/

# clean target
clean:
	$(rm -f $(PROGRAM) $(addsuffix .cpp, $(OBJS_FLUID)) $(addsuffix .hpp, $(OBJS_FLUID)) $(addsuffix .o, $(OBJS)) version.hpp OMakefile.omc OMakeroot.omc)

# update translation files
i18nupdate:
	xgettext -d florb -s -o i18n/florb.pot --keyword=_ --from-code=utf-8  $(find ./ -name *.cpp) $(find ./ -name *.hpp)
	foreach(t => ..., $(basename $(TRANSLATIONS)))
	    if $(file-exists ./i18n/$(t)/florb.po)
			msgmerge -U ./i18n/$(t)/florb.po i18n/florb.pot
	    else
			msginit --no-translator -l $(t).utf8 -o ./i18n/$(t)/florb.po -i i18n/florb.pot
		
# compile translations
i18ncompile:
	foreach(t => ..., $(basename $(TRANSLATIONS)))
		msgfmt -c -o ./i18n/$(t)/florb.mo ./i18n/$(t)/florb.po<commit_msg>Minor OMakefile cleanup.<commit_after># Program name
PROGRAM = florb

# Check if prefix is defined
if $(not $(defined PREFIX))
	PREFIX = /usr
	export

# Absolute path for prefix
PREFIX = $(absname $(PREFIX))

# Compiler and linker flags
CXX = $(shell fltk-config --cxx)
CXXFLAGS = -g -Wall -O2 -funroll-loops -DPREFIX=\"$(PREFIX)\" \
    $(shell fltk-config --use-images --cxxflags) \
	$(shell curl-config --cflags) \
	$(shell pkg-config --cflags sqlite3) \
	$(shell pkg-config --cflags tinyxml2) \
	$(shell pkg-config --cflags libgps) \
	$(shell pkg-config --cflags x11) \
	$(shell pkg-config --cflags xpm) \
	$(shell pkg-config --cflags yaml-cpp)
	
LDFLAGS = \
	$(shell fltk-config --use-images --ldflags) \
	$(shell curl-config --libs) \
	$(shell pkg-config --libs sqlite3) \
	$(shell pkg-config --libs tinyxml2) \
	$(shell pkg-config --libs libgps) \
	$(shell pkg-config --libs x11) \
	$(shell pkg-config --libs yaml-cpp) \
	$(shell pkg-config --libs xpm) \
	-lpthread \
	-lboost_system \
    -lboost_filesystem \
    -lboost_thread

# Phony targets
.PHONY: clean install i18nupdate i18ncompile

# Object files to be combined into the program binary. The last line combines
# fluid and regular source objects and eliminates duplicates for when fluid has
# already generated .cpp files.
OBJS_FLUID = $(rootname $(find . -name *.fl))
OBJS_CPP   = $(rootname $(find . -name *.cpp))
OBJS       = $(set $(OBJS_FLUID) $(OBJS_CPP))

# Find all translations
TRANSLATIONS =
    foreach(d => ..., $(find ./i18n/ -regex [a-z]{2\,2}_[A-Z]{2\,2}))
		value $(d)

# Generate version string (version.hpp) from repository information
version.hpp: ../.git/HEAD ../.git/index ./mkversionhpp.sh
    ./mkversionhpp.sh

# Rule for generating CPP code from fluid sources
%.cpp: %.fl
    fluid -c -o $@ -h $(replacesuffixes .cpp, .hpp, $@) $<

# Dependency scanner
.SCANNER: %.o: %.cpp :value: $(digest-in-path-optional $(INCLUDES), $&)
    $(CXX) -MM $(addprefix -I, $(INCLUDES)) $<

# Handle subdirectories
.SUBDIRS: ./fluid
	INCLUDES[] += ../

# Build the program
CGeneratedFiles($(addsuffix .cpp, $(OBJS_FLUID)) version.hpp)
CXXProgram($(PROGRAM), $(OBJS))
.DEFAULT: $(PROGRAM)$(EXE)

# install target
if $(not $(defined PREFIX))
    PREFIX = /usr/local
    export

# install target
install:
	mkdir($(PREFIX)/bin/ -p)
	install $(PROGRAM) $(PREFIX)/bin/
	foreach(t => ..., $(basename $(TRANSLATIONS)))
		mkdir -p $(PREFIX)/share/locale/$(t)/LC_MESSAGES/
		install ./i18n/$(t)/florb.mo $(PREFIX)/share/locale/$(t)/LC_MESSAGES/

# clean target
clean:
	$(rm -f $(PROGRAM) $(addsuffix .cpp, $(OBJS_FLUID)) $(addsuffix .hpp, $(OBJS_FLUID)) $(addsuffix .o, $(OBJS)) version.hpp OMakefile.omc OMakeroot.omc)

# update translation files
i18nupdate:
	xgettext -d florb -s -o i18n/florb.pot --keyword=_ --from-code=utf-8  $(find ./ -name *.cpp) $(find ./ -name *.hpp)
	foreach(t => ..., $(basename $(TRANSLATIONS)))
	    if $(file-exists ./i18n/$(t)/florb.po)
			msgmerge -U ./i18n/$(t)/florb.po i18n/florb.pot
	    else
			msginit --no-translator -l $(t).utf8 -o ./i18n/$(t)/florb.po -i i18n/florb.pot
		
# compile translations
i18ncompile:
	foreach(t => ..., $(basename $(TRANSLATIONS)))
		msgfmt -c -o ./i18n/$(t)/florb.mo ./i18n/$(t)/florb.po
{'fraction_non_alphanumeric': 0.18763523956723338, 'fraction_numerical': 0.013601236476043277, 'mean_word_length': 3.260039499670836, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '1721184', 'n_tokens_mistral': 2573, 'n_tokens_neox': 2365, 'n_words': 638}