<commit_before>CC = gcc 
 
TARGET = libnmea
BIN = lib/$(TARGET).a
MODULES = generate generator parse parser tok context time info gmath sentence  
SAMPLES = generate generator parse parse_file math
 
OBJ = $(MODULES:%=build/nmea_gcc/%.o) 
LINKOBJ = $(OBJ) $(RES)

SMPLS = $(SAMPLES:%=samples_%)
SMPLOBJ = $(SAMPLES:%=samples/%/main.o)

INCS = -I include 
LIBS = -lm -Llib -lnmea
 
.PHONY: all all-before all-after clean clean-custom doc debug
 
all: all-before $(BIN) samples all-after 

all-before:
	mkdir -p lib
	mkdir -p build/nmea_gcc

clean: clean-custom 
	rm -f $(LINKOBJ) $(BIN) $(SMPLOBJ) $(SMPLS)

doc:
	$(MAKE) -C doc
	
remake: clean all

debug: CFLAGS+=-g
debug: all

shared: CFLAGS+=-fPIC
shared: BIN+=lib/$(TARGET).so
shared:all

lib/$(TARGET).so: $(LINKOBJ)
	$(CC) -shared -Wl,-soname=$(TARGET) -o $@ $^ -lm

lib/$(TARGET).a: $(LINKOBJ)
	ar rsc $@ $^
	ranlib $@

build/nmea_gcc/%.o: src/%.c 
	$(CC) $(CFLAGS) $(INCS) -c $< -o $@

samples: $(SMPLS)

samples_%: samples/%/main.o
	$(CC) $< $(LIBS) -o build/$@

samples/%/main.o: samples/%/main.c
	$(CC) $(CFLAGS) $(INCS) -c $< -o $@<commit_msg>[Makefile] CROSS_COMPILE variable usage<commit_after>CC = $(CROSS_COMPILE)gcc
CC:=$(strip $(CC))

TARGET = libnmea
BIN:=lib/$(TARGET).a
MODULES = generate generator parse parser tok context time info gmath sentence  
SAMPLES = generate generator parse parse_file math
 
OBJ = $(MODULES:%=build/nmea_$(CC)/%.o) 
LINKOBJ = $(OBJ) $(RES)

SMPLS = $(SAMPLES:%=samples_%)
SMPLOBJ = $(SAMPLES:%=samples/%/main.o)

INCS = -I include 
LIBS = -lm -Llib -lnmea
 
.PHONY: all all-before all-after clean clean-custom doc debug shared

_default: static

all: all-before $(BIN) samples all-after 

all-before:
	mkdir -p lib
	mkdir -p build/nmea_$(CC)

clean: clean-custom 
	rm -f $(LINKOBJ) $(BIN) $(SMPLOBJ) $(SMPLS)

doc:
	$(MAKE) -C doc
	
remake: clean all

debug: CFLAGS+=-g
debug: all

static: BIN := lib/$(TARGET).a
static: all-before lib/$(TARGET).a samples all-after 

info:
	echo $(BIN)

shared: CFLAGS += -fPIC
shared: BIN += lib/$(TARGET).so
shared: all-before lib/$(TARGET).so samples all-after 

lib/$(TARGET).so: $(LINKOBJ)
	$(CC) -shared -Wl,-soname=$(TARGET) -o $@ $^ -lm

lib/$(TARGET).a: $(LINKOBJ)
	$(CROSS_COMPILE)ar rsc $@ $^
	$(CROSS_COMPILE)ranlib $@

build/nmea_$(CC)/%.o: src/%.c 
	$(CC) $(CFLAGS) $(INCS) -c $< -o $@

samples: $(SMPLS)

samples_%: samples/%/main.o
	$(CC) $< $(LIBS) -o build/$@

samples/%/main.o: samples/%/main.c
	$(CC) $(CFLAGS) $(INCS) -c $< -o $@
{'fraction_non_alphanumeric': 0.20088566827697263, 'fraction_numerical': 0.0, 'mean_word_length': 3.853515625, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 3, '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': '6007204', 'n_tokens_mistral': 1073, 'n_tokens_neox': 1016, 'n_words': 258}