Преглед на файлове

Work around definition of O_NOFOLLOW, and add target for only building and installing headers

Jeremy Soller преди 6 години
родител
ревизия
2fdca9bd0a
променени са 4 файла, в които са добавени 17 реда и са изтрити 3 реда
  1. 2 0
      Cargo.lock
  2. 8 2
      Makefile
  3. 4 0
      include/bits/fcntl.h
  4. 3 1
      src/header/fcntl/redox.rs

+ 2 - 0
Cargo.lock

@@ -1,3 +1,5 @@
+# This file is automatically @generated by Cargo.
+# It is not intended for manual editing.
 [[package]]
 name = "ansi_term"
 version = "0.11.0"

+ 8 - 2
Makefile

@@ -29,7 +29,7 @@ SRC=\
 	src/*/*/* \
 	src/*/*/*/*
 
-.PHONY: all clean fmt include install libc libm test
+.PHONY: all clean fmt headers install install-headers libc libm test
 
 all: | libc libm libpthread
 
@@ -44,13 +44,17 @@ check:
 fmt:
 	./fmt.sh
 
-install: all
+headers: $(BUILD)/include
+
+install-headers: headers
 	mkdir -pv "$(DESTDIR)/include"
 	cp -rv "include"/* "$(DESTDIR)/include"
 	cp -rv "$(BUILD)/include"/* "$(DESTDIR)/include"
 	cp -v "openlibm/include"/*.h "$(DESTDIR)/include"
 	cp -v "openlibm/src"/*.h "$(DESTDIR)/include"
 	cp -v "pthreads-emb/"*.h "$(DESTDIR)/include"
+
+install-libs: all
 	mkdir -pv "$(DESTDIR)/lib"
 	cp -v "$(BUILD)/release/libc.a" "$(DESTDIR)/lib"
 	cp -v "$(BUILD)/release/crt0.o" "$(DESTDIR)/lib"
@@ -59,6 +63,8 @@ install: all
 	cp -v "$(BUILD)/openlibm/libopenlibm.a" "$(DESTDIR)/lib/libm.a"
 	cp -v "$(BUILD)/pthreads-emb/libpthread.a" "$(DESTDIR)/lib/libpthread.a"
 
+install: install-headers install-libs
+
 libc: $(BUILD)/release/libc.a $(BUILD)/release/crt0.o $(BUILD)/release/crti.o $(BUILD)/release/crtn.o $(BUILD)/include
 
 libm: $(BUILD)/openlibm/libopenlibm.a

+ 4 - 0
include/bits/fcntl.h

@@ -1,6 +1,10 @@
 #ifndef _BITS_FCNTL_H
 #define _BITS_FCNTL_H
 
+#if (defined(__redox__))
+#define O_NOFOLLOW 0x80000000
+#endif
+
 #ifdef __cplusplus
 extern "C" {
 #endif

+ 3 - 1
src/header/fcntl/redox.rs

@@ -17,4 +17,6 @@ pub const O_EXCL: c_int = 0x0800_0000;
 pub const O_DIRECTORY: c_int = 0x1000_0000;
 pub const O_PATH: c_int = 0x2000_0000;
 pub const O_SYMLINK: c_int = 0x4000_0000;
-pub const O_NOFOLLOW: c_int = 0x8000_0000;
+// Negative to allow it to be used as int
+// TODO: Fix negative values missing from includes
+pub const O_NOFOLLOW: c_int = -0x8000_0000;