CFLAGS += $(shell pkg-config --cflags mount) LIBMOUNT = $(shell pkg-config --libs mount) all: c-mounts c-langinfo target/debug/learning-c-from-rust c-mounts: c-mounts.o $(CC) -Wall -o $@ $^ $(LIBMOUNT) c-langinfo: c-langinfo.o $(CC) -Wall -o $@ $^ # HACK: does not find stdarg.h (through stdio.h), missing size_t # also avoid hundreds of "should have an upper camel case name" warnings src/libmount.rs: sed 's/#include.*stdio.h.*/typedef unsigned long size_t;/' /usr/include/libmount/libmount.h > libmount-hack.h bindgen libmount-hack.h -- -I/usr/include/linux/ > $@.tmp (echo '#![allow(non_camel_case_types,non_upper_case_globals,dead_code)]'; cat $@.tmp) > $@ rm libmount-hack.h $@.tmp target/debug/learning-c-from-rust: src/libmount.rs src/main.rs cargo build clean: rm -f c-mounts c-langinfo *.o src/libmount.rs run: all LANG=en_US.UTF-8 ./c-langinfo LANG=en_GB.UTF-8 ./c-langinfo LANG=en_IE.UTF-8 ./c-langinfo ./c-mounts target/debug/learning-c-from-rust .PHONY: clean run