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