2018-05-16 14:47:04 +08:00
|
|
|
MAJOR_VERSION=1
|
|
|
|
MINOR_VERSION=0
|
|
|
|
|
2018-06-01 16:32:07 +08:00
|
|
|
VERSION_H = $(BUILDDIR)/include/acrnprobe/version.h
|
2018-04-25 10:19:46 +08:00
|
|
|
|
2018-07-17 15:55:25 +08:00
|
|
|
LIBS = -lpthread -lxml2 -lcrypto -lrt -lblkid -lext2fs -lcom_err \
|
|
|
|
$(EXTRA_LIBS)
|
2018-06-01 16:32:07 +08:00
|
|
|
INCLUDE += -I $(CURDIR)/include -I /usr/include/libxml2
|
|
|
|
INCLUDE += -I $(BUILDDIR)/include/acrnprobe
|
2018-04-25 10:19:46 +08:00
|
|
|
CFLAGS += $(INCLUDE)
|
2018-09-20 14:14:07 +08:00
|
|
|
CFLAGS += -fdata-sections
|
2018-04-25 10:19:46 +08:00
|
|
|
|
|
|
|
LDFLAGS += $(LIBS) -Wl,--gc-sections
|
|
|
|
|
|
|
|
TARGET = $(BUILDDIR)/acrnprobe/bin/acrnprobe
|
|
|
|
|
2018-06-01 16:32:07 +08:00
|
|
|
.PHONY: all check_dirs
|
|
|
|
all: $(VERSION_H) check_dirs $(TARGET)
|
2018-06-28 10:36:10 +08:00
|
|
|
rm -f $(VERSION_H)
|
2018-04-25 10:19:46 +08:00
|
|
|
|
|
|
|
$(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 \
|
2018-05-09 17:31:33 +08:00
|
|
|
$(BUILDDIR)/acrnprobe/obj/sender.o \
|
2018-05-09 17:33:56 +08:00
|
|
|
$(BUILDDIR)/acrnprobe/obj/startupreason.o \
|
2018-05-09 17:39:55 +08:00
|
|
|
$(BUILDDIR)/acrnprobe/obj/property.o \
|
|
|
|
$(BUILDDIR)/acrnprobe/obj/probeutils.o \
|
2018-05-10 09:38:01 +08:00
|
|
|
$(BUILDDIR)/acrnprobe/obj/history.o \
|
2018-07-17 15:34:28 +08:00
|
|
|
$(BUILDDIR)/acrnprobe/obj/android_events.o \
|
|
|
|
$(BUILDDIR)/acrnprobe/obj/loop.o
|
2018-04-25 10:19:46 +08:00
|
|
|
$(CC) -o $@ $^ $(LDFLAGS)
|
|
|
|
|
2018-06-01 16:32:07 +08:00
|
|
|
.PHONY: clean
|
2018-04-25 10:19:46 +08:00
|
|
|
clean:
|
|
|
|
@echo "Clean objects and binaries"
|
2018-06-01 16:32:07 +08:00
|
|
|
@if [ -e $(VERSION_H) ]; then \
|
|
|
|
$(RM) -f $(VERSION_H); \
|
2018-05-16 14:47:04 +08:00
|
|
|
fi
|
2018-04-25 10:19:46 +08:00
|
|
|
@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
|
|
|
|
|
2018-06-01 16:32:07 +08:00
|
|
|
$(VERSION_H):
|
|
|
|
@if [ ! -d $(BUILDDIR)/include/acrnprobe ]; then \
|
|
|
|
mkdir -p $(BUILDDIR)/include/acrnprobe ; \
|
|
|
|
fi
|
|
|
|
touch $(VERSION_H)
|
2018-05-16 14:47:04 +08:00
|
|
|
@COMMIT=`git log -1 --pretty=format:%h . 2>/dev/null`;\
|
2018-06-01 16:32:07 +08:00
|
|
|
DIRTY=`git diff --name-only $(CURDIR)`;\
|
2018-05-16 14:47:04 +08:00
|
|
|
if [ -n "$$DIRTY" ];then PATCH="$$COMMIT-dirty";else PATCH="$$COMMIT";fi;\
|
|
|
|
TIME=`date "+%Y-%m-%d %H:%M:%S"`;\
|
2018-06-28 10:36:10 +08:00
|
|
|
USER=`id -u -n`; \
|
2018-06-01 16:32:07 +08:00
|
|
|
cat $(CURDIR)/../license_header > $(VERSION_H);\
|
|
|
|
echo "#define AP_MAJOR_VERSION $(MAJOR_VERSION)" >> $(VERSION_H);\
|
|
|
|
echo "#define AP_MINOR_VERSION $(MINOR_VERSION)" >> $(VERSION_H);\
|
|
|
|
echo "#define AP_BUILD_VERSION "\""$$PATCH"\""" >> $(VERSION_H);\
|
|
|
|
echo "#define AP_BUILD_TIME "\""$$TIME"\""" >> $(VERSION_H);\
|
2018-06-28 10:36:10 +08:00
|
|
|
echo "#define AP_BUILD_USER "\""$$USER"\""" >> $(VERSION_H)
|
2018-05-16 14:47:04 +08:00
|
|
|
|
2018-04-25 10:19:46 +08:00
|
|
|
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
|