Change readme, and add changable build dir
This commit is contained in:
parent
804c8c5254
commit
4e3de1cfb2
18
Makefile
18
Makefile
|
@ -1,5 +1,7 @@
|
|||
LIB=libcx
|
||||
|
||||
BUILD_DIR?=build
|
||||
|
||||
COM_FLAGS = -fPIC -Isrc/include
|
||||
CC_FLAGS = -std=c23 -ggdb
|
||||
CXX_FLAGS = -std=c++23 -nostdinc++ -ggdb -fexceptions
|
||||
|
@ -11,28 +13,28 @@ AR=ar
|
|||
|
||||
cxx_sources=$(wildcard src/*.cpp)
|
||||
c_sources=$(wildcard src/*.c)
|
||||
objects=$(patsubst src/%.cpp,build/obj/%.cpp.o,$(cxx_sources)) $(patsubst src/%.c,build/obj/%.c.o,$(c_sources))
|
||||
objects=$(patsubst src/%.cpp,$(BUILD_DIR)/obj/%.cpp.o,$(cxx_sources)) $(patsubst src/%.c,$(BUILD_DIR)/obj/%.c.o,$(c_sources))
|
||||
|
||||
|
||||
all: shared static compile_commands.json
|
||||
|
||||
shared: build/$(LIB).so
|
||||
static: build/$(LIB).a
|
||||
shared: $(BUILD_DIR)/$(LIB).so
|
||||
static: $(BUILD_DIR)/$(LIB).a
|
||||
|
||||
build/$(LIB).a: $(objects)
|
||||
$(BUILD_DIR)/$(LIB).a: $(objects)
|
||||
$(AR) rcs $@ $^
|
||||
|
||||
build/$(LIB).so: $(objects)
|
||||
$(BUILD_DIR)/$(LIB).so: $(objects)
|
||||
$(LD) -shared -o $@ $^
|
||||
|
||||
clean:
|
||||
rm -r build/obj/
|
||||
rm -r $(BUILD_DIR)/obj/
|
||||
|
||||
build/obj/%.cpp.o: */%.cpp
|
||||
$(BUILD_DIR)/obj/%.cpp.o: */%.cpp
|
||||
@mkdir -p $(dir $@)
|
||||
$(CXX) -c -o $@ $< $(CXX_FLAGS) $(COM_FLAGS)
|
||||
|
||||
build/obj/%.c.o: */%.c
|
||||
$(BUILD_DIR)/obj/%.c.o: */%.c
|
||||
@mkdir -p $(dir $@)
|
||||
$(CC) -c -o $@ $< $(CC_FLAGS) $(COM_FLAGS)
|
||||
|
||||
|
|
16
README.md
16
README.md
|
@ -6,9 +6,23 @@ so headers will work for now as this is in heavy development.
|
|||
|
||||
## Building
|
||||
|
||||
Just run `make`, no other library than libc is used as of now. It will create both a static and shared library.
|
||||
Just run `make`. It will create both a static and shared library.
|
||||
I cant guarantee the shared lib working, cuz i dont really use it for now.
|
||||
|
||||
It only links with `libc` and `libgcc` but only with the supc++ library, the normal stdlib is stll non existant.\
|
||||
|
||||
Output from an executable that uses libcx:
|
||||
|
||||
```sh
|
||||
-> % ldd test/test
|
||||
linux-vdso.so.1 (0x0000785c05ea6000)
|
||||
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x0000785c05e20000)
|
||||
libc.so.6 => /usr/lib/libc.so.6 (0x0000785c05c30000)
|
||||
/lib64/ld-linux-x86-64.so.2 => /usr/lib64/ld-linux-x86-64.so.2 (0x0000785c05ea8000)
|
||||
```
|
||||
```
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
Just clone it and do the changes, then make a PR. Or even better just DM me on Discord: `@mcorange`
|
||||
|
|
Loading…
Reference in New Issue
Block a user