2018-04-25 10:19:46 +08:00
|
|
|
BASEDIR := $(shell pwd)
|
|
|
|
|
|
|
|
LIBS = -lpthread -lxml2 -lcrypto -lrt -lsystemd -ltelemetry
|
2018-05-09 17:10:53 +08:00
|
|
|
INCLUDE += -I $(BASEDIR)/include -I /usr/include/libxml2
|
2018-04-25 10:19:46 +08:00
|
|
|
CFLAGS += $(INCLUDE)
|
|
|
|
CFLAGS += -g -O0 -std=gnu11
|
|
|
|
CFLAGS += -ffunction-sections -fdata-sections
|
|
|
|
|
|
|
|
LDFLAGS += $(LIBS) -Wl,--gc-sections
|
|
|
|
|
|
|
|
TARGET = $(BUILDDIR)/acrnprobe/bin/acrnprobe
|
|
|
|
|
|
|
|
all: check_dirs $(TARGET)
|
|
|
|
|
|
|
|
$(BUILDDIR)/acrnprobe/obj/%.o:%.c
|
|
|
|
$(CC) -c $(CFLAGS) $< -o $@
|
|
|
|
|
2018-05-09 16:56:15 +08:00
|
|
|
$(BUILDDIR)/acrnprobe/bin/acrnprobe: $(BUILDDIR)/acrnprobe/obj/main.o \
|
|
|
|
$(BUILDDIR)/common/obj/log_sys.o \
|
|
|
|
$(BUILDDIR)/common/obj/cmdutils.o \
|
|
|
|
$(BUILDDIR)/common/obj/fsutils.o \
|
|
|
|
$(BUILDDIR)/common/obj/strutils.o \
|
|
|
|
$(BUILDDIR)/acrnprobe/obj/load_conf.o \
|
|
|
|
$(BUILDDIR)/acrnprobe/obj/channels.o \
|
|
|
|
$(BUILDDIR)/acrnprobe/obj/event_queue.o \
|
|
|
|
$(BUILDDIR)/acrnprobe/obj/event_handler.o \
|
|
|
|
$(BUILDDIR)/acrnprobe/obj/crash_reclassify.o \
|
|
|
|
$(BUILDDIR)/acrnprobe/obj/sender.o
|
2018-04-25 10:19:46 +08:00
|
|
|
$(CC) -o $@ $^ $(LDFLAGS)
|
|
|
|
|
|
|
|
clean:
|
|
|
|
@echo "Clean objects and binaries"
|
|
|
|
@if [ -d $(BUILDDIR)/acrnprobe/obj ]; then \
|
|
|
|
find $(BUILDDIR)/acrnprobe/obj -name "*.o" -exec $(RM) {} \; 2>&1 || exit 0; \
|
|
|
|
fi
|
|
|
|
@if [ -d $(BUILDDIR)/acrnprobe/bin ]; then \
|
|
|
|
$(RM) -r $(BUILDDIR)/acrnprobe/bin ; \
|
|
|
|
fi
|
|
|
|
@if [ -d $(BUILDDIR)/acrnprobe/obj ]; then \
|
|
|
|
$(RM) -r $(BUILDDIR)/acrnprobe/obj ; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
check_dirs:
|
|
|
|
@if [ ! -d $(BUILDDIR)/acrnprobe/bin ]; then \
|
|
|
|
mkdir -p $(BUILDDIR)/acrnprobe/bin ; \
|
|
|
|
fi
|
|
|
|
@if [ ! -d $(BUILDDIR)/acrnprobe/obj ]; then \
|
|
|
|
mkdir -p $(BUILDDIR)/acrnprobe/obj ; \
|
|
|
|
fi
|