So I finally fixed a bunch of includes that needed to be changed as a result of reorganisation and a number of code faults generated as a result of an API change, got everything to compile without issue only to find and the last stretch the linker can't connect the dots, someone tell me what I'm doing wrong here:
Code:
INC_PATHS=../include
IS_WINDOWS:=$(if $(Program Files),1,)
IS_WIN64:=$(if ${Program Files(x86)},1,)
IS_WIN32:=$(if $(IS_WIN64),,$(IS_WINDOWS))
EXE?=$(if $(IS_WINDOWS),exe,AppImage)
IFLAGS:=$(INC_PATHS:%=-I %)
CFLAGS:=-Wall $(IFLAGS)
mcc: libmcc_core.so
test: test.$(EXE)
libmcc_core.so: $(wildcard mcc/core/*.o)
gcc -lpthread -o $@ $^
test.AppImage: test/unit_tests.o libmcc_core.so
gcc -o $@ $^
mcc/core/vflt.c: mcc/core/vflt.h
mcc/core/vint.c: mcc/core/vint.h
mcc/core/get.c: mcc/core/get.h
mcc/core/mem.c: mcc/core/mem.h
mcc/core/vflt.h: mcc/core/vint.h
mcc/core/vint.h: mcc/core/get.h
mcc/core/get.h: mcc/core/mem.h
mcc/core/mem.h: mcc/malloc.h
mcc/malloc.h: mcc/vmalloc.h
mcc/vmalloc.h: mcc/inttypes.h
mcc/inttypes.h: mcc/stdint.h
mcc/stdint.h: mcc/limits.h
mcc/limits.h: mcc/core/sys.h
mcc/core/sys.h:
test/unit_tests.o: test/unit_tests.c
test/unit_tests.c: test/core/vint.c
%.o: %.c
clang $(CFLAGS) -o $@ -c $<
force: ;
Output from my attempt:
Code:
...
make[2]: Entering directory '~/mitsy/src'
clang -Wall -I ../include -o test/unit_tests.o -c test/unit_tests.c
gcc -lpthread -o libmcc_core.so mcc/core/vint.o mcc/core/vflt.o mcc/core/get.o mcc/core/mem.o
gcc -o test.AppImage test/unit_tests.o libmcc_core.so
/usr/bin/ld: test/unit_tests.o: in function `test__vint':
unit_tests.c:(.text+0x487): undefined reference to `mcc_vint_wrap'
/usr/bin/ld: unit_tests.c:(.text+0x4af): undefined reference to `mcc_vint_size_and_fill'
/usr/bin/ld: unit_tests.c:(.text+0x4e2): undefined reference to `mcc_vint_wrap'
/usr/bin/ld: unit_tests.c:(.text+0x513): undefined reference to `mcc_vint_size_and_fill'
/usr/bin/ld: unit_tests.c:(.text+0x546): undefined reference to `mcc_vint_wrap'
/usr/bin/ld: unit_tests.c:(.text+0x577): undefined reference to `mcc_vint_size_and_fill'
/usr/bin/ld: unit_tests.c:(.text+0x5f3): undefined reference to `mcc__vint_op_not'
/usr/bin/ld: unit_tests.c:(.text+0x65b): undefined reference to `mcc__vint_op_aor'
/usr/bin/ld: unit_tests.c:(.text+0x6c3): undefined reference to `mcc__vint_op_xor'
/usr/bin/ld: unit_tests.c:(.text+0x72b): undefined reference to `mcc__vint_op_and'
/usr/bin/ld: unit_tests.c:(.text+0x77b): undefined reference to `mcc__vint_op_inc'
/usr/bin/ld: unit_tests.c:(.text+0x7e3): undefined reference to `mcc__vint_op_add'
/usr/bin/ld: unit_tests.c:(.text+0x84c): undefined reference to `mcc__vint_op_mul'
/usr/bin/ld: unit_tests.c:(.text+0x89c): undefined reference to `mcc__vint_op_dec'
/usr/bin/ld: unit_tests.c:(.text+0x905): undefined reference to `mcc__vint_op_sub'
/usr/bin/ld: unit_tests.c:(.text+0x9df): undefined reference to `mcc___vint_op_div'
/usr/bin/ld: unit_tests.c:(.text+0xa95): undefined reference to `mcc___vint_op_div'
/usr/bin/ld: unit_tests.c:(.text+0xb52): undefined reference to `mcc__vint_op_cmp'
/usr/bin/ld: unit_tests.c:(.text+0xb9d): undefined reference to `mcc_vint_to_val'
/usr/bin/ld: unit_tests.c:(.text+0xc22): undefined reference to `mcc__vint_op_cmp'
/usr/bin/ld: unit_tests.c:(.text+0xc6d): undefined reference to `mcc_vint_to_val'
/usr/bin/ld: unit_tests.c:(.text+0xcf1): undefined reference to `mcc__vint_op_cmp'
/usr/bin/ld: unit_tests.c:(.text+0xd3c): undefined reference to `mcc_vint_to_val'
/usr/bin/ld: unit_tests.c:(.text+0xdd6): undefined reference to `mcc__vint_op_shr'
/usr/bin/ld: unit_tests.c:(.text+0xe5a): undefined reference to `mcc__vint_op_cmp'
/usr/bin/ld: unit_tests.c:(.text+0xea5): undefined reference to `mcc_vint_to_val'
/usr/bin/ld: unit_tests.c:(.text+0xf15): undefined reference to `mcc__vint_op_cmp'
make[2]: Leaving directory '~/mitsy/src'
make[1]: Leaving directory '~/mitsy/src/test'
/usr/bin/ld: unit_tests.c:(.text+0xf60): undefined reference to `mcc_vint_to_val'
/usr/bin/ld: unit_tests.c:(.text+0xfe2): undefined reference to `mcc__vint_op_shl'
/usr/bin/ld: unit_tests.c:(.text+0x1066): undefined reference to `mcc__vint_op_cmp'
/usr/bin/ld: unit_tests.c:(.text+0x10b1): undefined reference to `mcc_vint_to_val'
/usr/bin/ld: unit_tests.c:(.text+0x1121): undefined reference to `mcc__vint_op_cmp'
/usr/bin/ld: unit_tests.c:(.text+0x116c): undefined reference to `mcc_vint_to_val'
/usr/bin/ld: unit_tests.c:(.text+0x1218): undefined reference to `mcc_vint_size'
/usr/bin/ld: unit_tests.c:(.text+0x1231): undefined reference to `mcc_vint_size'
/usr/bin/ld: unit_tests.c:(.text+0x124a): undefined reference to `mcc_vint_size'
collect2: error: ld returned 1 exit status
make[2]: *** [makefile:16: test.AppImage] Error 1
make[1]: *** [makefile:2: makefile] Error 2
make: *** [makefile:2: makefile] Error 2
Compilation failed.