I'v written the Makefile below. I'm getting the following error during compilation. I'm not sure what IBS
is? Is it missing the L
from LIBS
or something?
Follow on question:
This is the directory structure.
.
├── Makefile
└── src
├── include
│ └── utils.h
├── main.c
└── utils.c
However, when I run make, this is the output. It doesn't seem to be picking up and building the file utils.c
?
cc -I./src -I./src/include -I/usr/local/include/upm -MMD -MP -c src/main.c -o build/./src/main.c.o.o
TARGET_EXEC ?= app.out
BUILD_DIR ?= ./build
SRC_DIRS ?= ./src
SRCS := $(shell find $(SRC_DIRS) -name *.cpp -or -name *.c -or -name *.s)
OBJS := $(SRCS:%=$(BUILD_DIR)/%.o)
DEPS := $(OBJS:.o=.d)
INC_DIRS := $(shell find $(SRC_DIRS) -type d)
INC_FLAGS := $(addprefix -I,$(INC_DIRS)) -I/usr/local/include/upm
CPPFLAGS ?= $(INC_FLAGS) -MMD -MP
$(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
$(CC) $(OBJS) -o $@ $(LDFLAGS)
LD_FLAGS = -L/usr/local/lib/upm -L/usr/lib/rabbitmq
LIBS = -lrabbitmq -lupmc-rn2483 -lupmc-rn2903 -lupmc-utilities
# c source
$(BUILD_DIR)/%.c.o: %.c
$(MKDIR_P) $(dir $@)
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@.o
$(CC) $(LD_FLAGS) $@.o -o $@ $LIBS
.PHONY: clean
clean:
$(RM) -r $(BUILD_DIR)
-include $(DEPS)
MKDIR_P ?= mkdir -p