Issue with compilation of C library on Ubuntu

53 Views Asked by At

Sorry in advance for the probably dumb question.

I am trying to compile a custom library, written in C, on an Ubuntu 22 OS ($SYS = Linux-generic-x86_64). The rough structure of the available Makefile is

ADS  =       /destination/folder

.KEEP_STATE:
.PARALLEL:

CFLAGS = -xc99
CPPPFLAGS-x86_64  = -D_GNU_SOURCE -DLinux -DLITTLE_ENDIAN
CPPFLAGS += -I../include -I../../common
CPPFLAGS += $(CPPPFLAGS$(TARGET_ARCH))

CC = cc
VARIANT = ../$(SYS)/.dynamic/
.KEEP_STATE_FILE: ../$(SYS)/.make.state

linux   := CFLAGS  += -g -fPIC

BBSOURCES= (several .c source files)
DDSOURCES=  (several .c source files)
WWSOURCES=  (several .c source files)
TTSOURCES=  (several .c source files)

LSOURCES=   $(BBSOURCES) $(DDSOURCES) $(WWSOURCES) $(TTSOURCES)
LOBJECTS=   $(LSOURCES:%.c=$(VARIANT)%.o)

linux:  $$(LOBJECTS)

$$(VARIANT)%.o: %.c
    $(COMPILE.c) $< -o $@

According to the README, the commands for the compilation should be

sh -c '$(MAKE) linux'
sh -c 'cd $(SYS)/.dynamic; $(MAKE) -f .dynamic_makefile dynamic'

where the content of the file $(SYS)/.dynamic/.dynamic_makefile is

LD     = ld
LIB = ../compiled_library.so
dynamic:
       $(CC) -shared -o $(LIB) *.o -lnsl -lc

clean:
    rm *.o

However, when I try, I get the error

make: *** No rule to make target '$(LOBJECTS)', needed by 'linux'. Stop.

Is there something wrong I am doing?

0

There are 0 best solutions below