mirror of
https://github.com/EnderIce2/Fennix.git
synced 2025-05-28 15:34:31 +00:00
feat(userspace): add dummy libstdc++ library
Signed-off-by: EnderIce2 <enderice2@protonmail.com>
This commit is contained in:
parent
7ec85e67df
commit
88a3b0912b
@ -19,7 +19,8 @@
|
|||||||
"devcontainer",
|
"devcontainer",
|
||||||
"userspace/libs",
|
"userspace/libs",
|
||||||
"userspace/apps/test",
|
"userspace/apps/test",
|
||||||
"userspace/apps/usr"
|
"userspace/apps/usr",
|
||||||
|
"userspace"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,11 @@ build:
|
|||||||
cp -a $(CURDIR)/include/. $(WORKSPACE_DIR)/out/include
|
cp -a $(CURDIR)/include/. $(WORKSPACE_DIR)/out/include
|
||||||
make -C libgcc build
|
make -C libgcc build
|
||||||
make -C libm build
|
make -C libm build
|
||||||
|
make -C libstdc++ build
|
||||||
make -C libexample build
|
make -C libexample build
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
make -C libgcc clean
|
make -C libgcc clean
|
||||||
make -C libm clean
|
make -C libm clean
|
||||||
|
make -C libstdc++ clean
|
||||||
make -C libexample clean
|
make -C libexample clean
|
||||||
|
48
Userspace/libs/libstdc++/Makefile
Normal file
48
Userspace/libs/libstdc++/Makefile
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
default:
|
||||||
|
$(error Do not run this Makefile directly!)
|
||||||
|
|
||||||
|
DYNAMIC_NAME := $(notdir $(shell pwd)).so
|
||||||
|
STATIC_NAME := $(notdir $(shell pwd)).a
|
||||||
|
|
||||||
|
OUTPUT_DIR=$(WORKSPACE_DIR)/out/lib/
|
||||||
|
SYSROOT = --sysroot=$(WORKSPACE_DIR)/out/
|
||||||
|
|
||||||
|
S_SOURCES = $(shell find ./ -type f -name '*.S')
|
||||||
|
C_SOURCES = $(shell find ./ -type f -name '*.c')
|
||||||
|
CXX_SOURCES = $(shell find ./ -type f -name '*.cpp')
|
||||||
|
OBJ = ${S_SOURCES:.S=.o} ${C_SOURCES:.c=.o} ${CXX_SOURCES:.cpp=.o}
|
||||||
|
|
||||||
|
CFLAGS := -fvisibility=hidden -fPIC -I../include -I$(WORKSPACE_DIR)/out/include -DLIBC_GIT_COMMIT='"$(shell git rev-parse HEAD)"'
|
||||||
|
|
||||||
|
ifeq ($(DEBUG), 1)
|
||||||
|
CFLAGS += -DDEBUG -ggdb3 -O0 -fdiagnostics-color=always
|
||||||
|
endif
|
||||||
|
|
||||||
|
build: $(DYNAMIC_NAME) $(STATIC_NAME)
|
||||||
|
|
||||||
|
.PHONY: $(DYNAMIC_NAME) $(STATIC_NAME)
|
||||||
|
|
||||||
|
$(DYNAMIC_NAME): $(OBJ)
|
||||||
|
$(info Linking $@)
|
||||||
|
$(CC) -nostdlib -shared -fPIC -fPIE -Wl,-soname,$(DYNAMIC_NAME) $(SYSROOT) $(OBJ) -o $(DYNAMIC_NAME)
|
||||||
|
cp $(DYNAMIC_NAME) $(OUTPUT_DIR)$(DYNAMIC_NAME)
|
||||||
|
|
||||||
|
$(STATIC_NAME): $(OBJ)
|
||||||
|
$(info Linking $@)
|
||||||
|
$(AR) -rcs $(STATIC_NAME) $(OBJ)
|
||||||
|
cp $(STATIC_NAME) $(OUTPUT_DIR)$(STATIC_NAME)
|
||||||
|
|
||||||
|
%.o: %.c
|
||||||
|
$(info Compiling $<)
|
||||||
|
$(CC) $(CFLAGS) -std=c17 -c $< -o $@
|
||||||
|
|
||||||
|
%.o: %.cpp
|
||||||
|
$(info Compiling $<)
|
||||||
|
$(CC) $(CFLAGS) -std=c++20 -c $< -o $@
|
||||||
|
|
||||||
|
%.o: %.S
|
||||||
|
$(info Compiling $<)
|
||||||
|
$(AS) -c $< -o $@
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(OBJ) $(DYNAMIC_NAME) $(STATIC_NAME)
|
18
Userspace/libs/libstdc++/libstdc++.c
Normal file
18
Userspace/libs/libstdc++/libstdc++.c
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
/*
|
||||||
|
This file is part of Fennix Userspace.
|
||||||
|
|
||||||
|
Fennix Userspace is free software: you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU General Public License as
|
||||||
|
published by the Free Software Foundation, either version 3 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
Fennix Userspace is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with Fennix Userspace. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* dummy file */
|
Loading…
x
Reference in New Issue
Block a user