Jeremy Soller před 6 roky
rodič
revize
124e118f9f
2 změnil soubory, kde provedl 11 přidání a 10 odebrání
  1. 9 8
      Makefile
  2. 2 2
      include.sh

+ 9 - 8
Makefile

@@ -20,7 +20,7 @@ SRC=\
 	src/*/*/* \
 	src/*/*/*/*
 
-.PHONY: all clean fmt install libc libm test
+.PHONY: all clean fmt include install libc libm test
 
 all: | libc libm
 
@@ -45,18 +45,19 @@ install: all
 	cp -rv "openlibm/src"/*.h "$(DESTDIR)/include"
 	cp -v "$(BUILD)/openlibm/libopenlibm.a" "$(DESTDIR)/lib/libm.a"
 
-header:
-	mkdir -p header
-	./header.sh
-	touch header
-
-libc: $(BUILD)/release/libc.a $(BUILD)/release/crt0.o
+libc: $(BUILD)/include $(BUILD)/release/libc.a $(BUILD)/release/crt0.o
 
 libm: $(BUILD)/openlibm/libopenlibm.a
 
 test: all
 	make -C tests run
 
+$(BUILD)/include: $(SRC)
+	rm -rf $@ $@.partial
+	mkdir -p $@.partial
+	./include.sh $@.partial
+	mv $@.partial $@
+
 $(BUILD)/debug/libc.a: $(SRC)
 	cargo build $(CARGOFLAGS)
 	touch $@
@@ -80,5 +81,5 @@ $(BUILD)/openlibm: openlibm
 	mv $@.partial $@
 	touch $@
 
-$(BUILD)/openlibm/libopenlibm.a: $(BUILD)/openlibm
+$(BUILD)/openlibm/libopenlibm.a: $(BUILD)/openlibm $(BUILD)/include
 	make CC=$(CC) CPPFLAGS="-fno-stack-protector -I$(shell pwd)/include -I $(shell pwd)/target/include" -C $< libopenlibm.a

+ 2 - 2
header.sh → include.sh

@@ -2,7 +2,7 @@
 
 set -ex
 
-header="$(realpath header)"
+include="$(realpath "$1")"
 cbindgen="$(realpath cbindgen)"
 
 for config in src/header/*/cbindgen.toml
@@ -11,6 +11,6 @@ do
     name="$(basename "$dir")"
     pushd "$dir"
     cargo run --release --manifest-path "$cbindgen/Cargo.toml" -- \
-        -c cbindgen.toml -o "$header/$name.h" mod.rs
+        -c cbindgen.toml -o "$include/$name.h" mod.rs
     popd
 done