mirror of
https://github.com/thepigeongenerator/mcaselector-lite.git
synced 2025-12-18 20:55:44 +01:00
Compare commits
5 Commits
88eae600c4
...
7db3e97085
| Author | SHA1 | Date | |
|---|---|---|---|
| 7db3e97085 | |||
| ed5aed474e | |||
| 14caacf95e | |||
| e377b4ee29 | |||
| 21bb6ff79a |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -18,4 +18,6 @@
|
||||
*.lock
|
||||
/bin/
|
||||
/obj/
|
||||
/lib/obj/
|
||||
compile_commands.json
|
||||
compile_commands.events.json
|
||||
|
||||
19
Makefile
19
Makefile
@@ -22,9 +22,8 @@ else
|
||||
CFLAGS += -fsanitize=address -ftrapv -g
|
||||
LDFLAGS += -fsanitize=address -ftrapv
|
||||
endif
|
||||
# TODO: correctly add all libraries and headers here
|
||||
CPPFLAGS += -Iinclude -Ilib/glad/include -Ilib/glfw/include -Ilib/libarchive/libarchive
|
||||
LDFLAGS += -Lobj/lib/glfw/src -Lobj/lib/libarchive/libarchive
|
||||
LDFLAGS += -Llib/obj/glfw/src -Llib/obj/libarchive/libarchive
|
||||
LDLIBS += -lm -lglfw -larchive
|
||||
|
||||
# detect if we're compiling on Windows, meaning
|
||||
@@ -36,7 +35,7 @@ $(warning Detected Windows_NT, please refer to the documentation if you encounte
|
||||
endif
|
||||
|
||||
# TODO: find a better method to find all source files
|
||||
# TODO: find a better method for selecting the object files
|
||||
# WARN: find a better method for selecting the object files
|
||||
# find all the source files using wildcards
|
||||
# NOTE: MS-DOS and MS-Windows uses backslash `\`, this might break.
|
||||
RES := $(wildcard res/*.glsl)
|
||||
@@ -44,27 +43,31 @@ SRC := $(wildcard src/*.c src/*/*.c src/*/*/*.c src/*/*/*/*.c src/*/*/*/*/*
|
||||
OBJ := $(SRC:%.c=obj/%.o)
|
||||
TEST := $(wildcard test/*.c test/*/*.c test/*/*/*.c test/*/*/*/*.c test/*/*/*/*/*.c test/*/*/*/*/*/*.c test/*/*/*/*/*/*/*.c test/*/*/*/*/*/*/*/*.c)
|
||||
|
||||
.PHONY: all test clean libs
|
||||
# TODO: potentially automatically detect whether we should compile libs, or if we can just go ahead.
|
||||
.PHONY: all libs test clean clean-libs
|
||||
all: bin/$(NAME)
|
||||
libs: obj/lib/glfw/ obj/lib/libarchive/
|
||||
libs: lib/obj/glfw/ lib/obj/libarchive/
|
||||
test: bin/TEST_$(NAME); bin/TEST_$(NAME)
|
||||
clean:
|
||||
@[ -d bin/ ] && rm -vr bin/ || true
|
||||
@[ -d obj/ ] && rm -vr obj/ || true
|
||||
clean-libs:
|
||||
@[ -d lib/obj/ ] && rm -vr lib/obj/
|
||||
|
||||
|
||||
# compiles the libraries using cmake
|
||||
obj/lib/%/: lib/%/
|
||||
lib/obj/%/: lib/%/
|
||||
cmake -S $< -B $@
|
||||
$(MAKE) -C $@
|
||||
|
||||
# link together a runtime binary
|
||||
bin/$(NAME): libs $(OBJ)
|
||||
bin/$(NAME): $(OBJ)
|
||||
$(info [CC/LD] $@)
|
||||
@mkdir -p $(@D)
|
||||
@$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
|
||||
|
||||
# link together a testing binary
|
||||
# TODO: testing sources must be selected better
|
||||
# BUG: testing sources must be selected better
|
||||
bin/TEST_$(NAME): $(OBJ)
|
||||
$(info [CC/LD] $@)
|
||||
@mkdir -p $(@D)
|
||||
|
||||
@@ -16,19 +16,19 @@
|
||||
#define htole16(x) (x)
|
||||
#define htole32(x) (x)
|
||||
#define htole64(x) (x)
|
||||
#define be16toh(x) __bswap_16(x)
|
||||
#define be32toh(x) __bswap_32(x)
|
||||
#define be64toh(x) __bswap_64(x)
|
||||
#define htobe16(x) __bswap_16(x)
|
||||
#define htobe32(x) __bswap_32(x)
|
||||
#define htobe64(x) __bswap_64(x)
|
||||
#define be16toh(x) bswap_16(x)
|
||||
#define be32toh(x) bswap_32(x)
|
||||
#define be64toh(x) bswap_64(x)
|
||||
#define htobe16(x) bswap_16(x)
|
||||
#define htobe32(x) bswap_32(x)
|
||||
#define htobe64(x) bswap_64(x)
|
||||
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
#define le16toh(x) __bswap_16(x)
|
||||
#define le32toh(x) __bswap_32(x)
|
||||
#define le64toh(x) __bswap_64(x)
|
||||
#define htole16(x) __bswap_16(x)
|
||||
#define htole32(x) __bswap_32(x)
|
||||
#define htole64(x) __bswap_64(x)
|
||||
#define le16toh(x) bswap_16(x)
|
||||
#define le32toh(x) bswap_32(x)
|
||||
#define le64toh(x) bswap_64(x)
|
||||
#define htole16(x) bswap_16(x)
|
||||
#define htole32(x) bswap_32(x)
|
||||
#define htole64(x) bswap_64(x)
|
||||
#define be16toh(x) (x)
|
||||
#define be32toh(x) (x)
|
||||
#define be64toh(x) (x)
|
||||
|
||||
10
src/error.h
10
src/error.h
@@ -15,8 +15,8 @@ void error_war(uint ln, const char *restrict file, const char *restrict fmt, ...
|
||||
void error_err(uint ln, const char *restrict file, const char *restrict fmt, ...);
|
||||
void error_fat(uint ln, const char *restrict file, const char *restrict fmt, ...) NORET;
|
||||
|
||||
#define debug(s, ...) error_dbg(__LINE__, __FILE__, s, ##__VA_ARGS__)
|
||||
#define info(s, ...) error_inf(__LINE__, __FILE__, s, ##__VA_ARGS__)
|
||||
#define warn(s, ...) error_war(__LINE__, __FILE__, s, ##__VA_ARGS__)
|
||||
#define error(s, ...) error_err(__LINE__, __FILE__, s, ##__VA_ARGS__)
|
||||
#define fatal(s, ...) error_fat(__LINE__, __FILE__, s, ##__VA_ARGS__)
|
||||
#define debug(...) error_dbg(__LINE__, __FILE__ __VA_OPT__(, ) __VA_ARGS__)
|
||||
#define info(...) error_inf(__LINE__, __FILE__ __VA_OPT__(, ) __VA_ARGS__)
|
||||
#define warn(...) error_war(__LINE__, __FILE__ __VA_OPT__(, ) __VA_ARGS__)
|
||||
#define error(...) error_err(__LINE__, __FILE__ __VA_OPT__(, ) __VA_ARGS__)
|
||||
#define fatal(...) error_fat(__LINE__, __FILE__ __VA_OPT__(, ) __VA_ARGS__)
|
||||
|
||||
Reference in New Issue
Block a user