]> piware.de Git - learn-rust.git/blob - call-c-from-rust/Makefile
simple-http: Add scaffolding for thread pool implementation
[learn-rust.git] / call-c-from-rust / Makefile
1 CFLAGS += $(shell pkg-config --cflags mount)
2 LIBMOUNT = $(shell pkg-config --libs mount)
3
4 all: c-mounts c-langinfo target/debug/learning-c-from-rust
5
6 c-mounts: c-mounts.o
7         $(CC) -Wall -o $@ $^ $(LIBMOUNT)
8
9 c-langinfo: c-langinfo.o
10         $(CC) -Wall -o $@ $^
11
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
14 src/libmount.rs:
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
19
20 target/debug/learning-c-from-rust: src/libmount.rs src/main.rs
21         cargo build
22
23 clean:
24         rm -f c-mounts c-langinfo *.o src/libmount.rs
25
26 run: all
27         LANG=en_US.UTF-8 ./c-langinfo
28         LANG=en_GB.UTF-8 ./c-langinfo
29         LANG=en_IE.UTF-8 ./c-langinfo
30         ./c-mounts
31         target/debug/learning-c-from-rust
32
33 .PHONY: clean run