Using library.json to emulate make file

hi…i have an open source project which uses a library which i need to adapt to be embedded as create a PR for it…
the problem is that the libary uses a makefile to build, which mean it has several folders of source code (which aside from src and include) which won’t compile unless they’ll see each other
for example i have one source file in src folder which uses stpncpy.c , i have other source files in extra folder which use the source files in src folder so they won’t compile unless they’ll see them
my only other option is to create pre-post python scrypt that just copy all the src files i need from one folder to another into lib folder

#####
# Copyright (c) 2018 Y Paritcher
#####

PREFIX=$$HOME/x-tools/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-
PREFIXKT4=arm-kindlepw2-linux-gnueabi-
CC=gcc
AR=ar
RANLIB=ranlib
CFLAGS=-Wall -Wextra -Wno-format-truncation -O2 -flto -pedantic $(INC_DIR:%=-I%)
LDLIBS=-lm

INC_DIR = include
STATICDIR=build/static
SHAREDDIR=build/shared
LIBDIR=lib
SRCDIR=src/
EXTRADIR=extra/
FFIDIR=ffi-cdecl/
LUADIR=lua/
PYTHONDIR=python/
sharedobjects := $(patsubst $(SRCDIR)%.c,$(SHAREDDIR)/%.o,$(wildcard $(SRCDIR)*.c))
staticobjects := $(patsubst $(SRCDIR)%.c,$(STATICDIR)/%.o,$(wildcard $(SRCDIR)*.c))
extraexecs := $(patsubst %.c, %, $(wildcard $(EXTRADIR)*.c))
fficdefs := $(LUADIR)libzmanim.lua $(PYTHONDIR)libzmanim_cdef.py

TESTDIR=test/
TESTLDFLAGS=-L$(LIBDIR)
TESTLDLIBS=-lzmanim
TESTLDLIB=-l:libzmanim.a
testobjects := $(patsubst %.c,%.o,$(wildcard $(TESTDIR)*.c))

VPATH = src $(INC_DIR)

.PHONY: clean cleaner all shared static test directories teststatic testshared teststandard kindle KT4 fresh extra wasm rock ffi

all:
	$(MAKE) directories
	$(MAKE) shared static
	$(MAKE) test extra

kindle: CC = $(PREFIX)gcc
kindle: AR = $(PREFIX)ar
kindle: RANLIB = $(PREFIX)ranlib
kindle: directories shared static test

KT4: CC = $(PREFIXKT4)gcc
KT4: AR = $(PREFIXKT4)gcc-ar
KT4: RANLIB = $(PREFIXKT4)gcc-ranlib
KT4: directories shared static test

rock: cleaner directories shared

wasm: CC = clang
wasm: CFLAGS= -DNOSTDLIB -Wall -Wextra --target=wasm32 -nostdlib -mmultivalue -Xclang -target-abi -Xclang experimental-mv -Wl,--no-entry -Wl,--export-all $(INC_DIR:%=-I%)
wasm: $(LIBDIR)/libzmanim.wasm

directories: | $(SHAREDDIR) $(STATICDIR) $(LIBDIR)

shared: $(LIBDIR)/libzmanim.so

static: $(LIBDIR)/libzmanim.a

test: teststatic testshared teststandard

teststatic: static $(TESTDIR)teststatic

testshared: shared $(TESTDIR)testshared

teststandard: static $(TESTDIR)test

$(LIBDIR):
	mkdir -p $(LIBDIR)

$(STATICDIR):
	mkdir -p $(STATICDIR)

$(SHAREDDIR):
	mkdir -p $(SHAREDDIR)

$(LIBDIR)/libzmanim.so: $(sharedobjects)
	$(CC) -shared $(LDFLAGS) $^ $(LDLIBS) -o $@

$(LIBDIR)/libzmanim.a: $(staticobjects)
	$(AR) rc $@ $^
	$(RANLIB) $@

$(LIBDIR)/libzmanim.wasm: $(wildcard $(SRCDIR)hebrewcalendar.c)
	$(CC) $(CFLAGS) -o $@ $^

$(SHAREDDIR)/%.o: $(SRCDIR)%.c
	$(CC) -fPIC -c $(CPPFLAGS) $(CFLAGS) $< -o $@

$(STATICDIR)/%.o: $(SRCDIR)%.c
	$(CC) -static -c $(CPPFLAGS) $(CFLAGS) $< -o $@

$(TESTDIR)%.o: $(TESTDIR)%.c
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $< -o $@

$(TESTDIR)teststatic: $(testobjects)
	$(CC) -static $(TESTLDFLAGS) $^ $(TESTLDLIBS) -lm -o $@

$(TESTDIR)testshared: $(testobjects)
	$(CC) $(TESTLDFLAGS) $^ $(TESTLDLIBS) -o $@

$(TESTDIR)test: $(testobjects)
	$(CC) $(TESTLDFLAGS) $^ $(TESTLDLIB) $(LDLIBS) -o $@

testobjects: shared static

extra: static $(extraexecs)

$(extraexecs): %: %.c
	$(CC) $(CFLAGS) $(TESTLDFLAGS) $^ $(TESTLDLIB) $(LDLIBS) -o $@

install:
	mkdir -p $(INST_LIBDIR)
	cp lib/libzmanim.so $(INST_LIBDIR)
	mkdir -p $(INST_LUADIR)
	cp $(LUADIR)libzmanim.lua $(INST_LUADIR)
	cp $(LUADIR)libzmanim_load.lua $(INST_LUADIR)

$(fficdefs): $(FFIDIR)libzmanim.c
	CPPFLAGS="$(INC_DIR:%=-I%)" ffi-cdecl $(CC) $^ $@

ffi: $(fficdefs)

clean:
	rm -f $(SHAREDDIR)/*.o $(STATICDIR)/*.o $(TESTDIR)test.o

cleaner: clean
	rm -f $(LIBDIR)/libzmanim.so $(LIBDIR)/libzmanim.a $(TESTDIR)testshared $(TESTDIR)teststatic $(TESTDIR)test $(extraexecs) $(LIBDIR)/libzmanim.wasm $(fficdefs)

fresh:
	$(MAKE) cleaner
	$(MAKE) all

Is it not sufficient that all include paths are exactly like in the Makefile? Using the build attributes.

but the build attributes only allow for one src folder and one include folder, that’s it.

Btw i also tried using flags “-Iwindows” and " -Lwindows"
But i still gor “undefined reference”

These are BASE folders. If you need to build ALL files starting from the root of the library, please set srcDir to . (dot). We updated docs.