[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULLv2 10/12] slirp: add a standalone Makefile
From: |
Samuel Thibault |
Subject: |
[Qemu-devel] [PULLv2 10/12] slirp: add a standalone Makefile |
Date: |
Thu, 7 Mar 2019 12:51:41 +0100 |
From: Marc-André Lureau <address@hidden>
Add a simple Makefile to build libslirp.a, a static library version of
libslirp, to be used by QEMU during a transition period, until a
shared library is available.
Signed-off-by: Marc-André Lureau <address@hidden>
Message-Id: <address@hidden>
Signed-off-by: Samuel Thibault <address@hidden>
---
slirp/Makefile | 47 +++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 47 insertions(+)
create mode 100644 slirp/Makefile
diff --git a/slirp/Makefile b/slirp/Makefile
new file mode 100644
index 0000000000..6d48f626ba
--- /dev/null
+++ b/slirp/Makefile
@@ -0,0 +1,47 @@
+ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
+BUILD_DIR ?= .
+
+LIBSLIRP = $(BUILD_DIR)/libslirp.a
+
+all: $(LIBSLIRP)
+
+SRCS := $(wildcard src/*.c)
+OBJS := $(SRCS:%.c=$(BUILD_DIR)/%.o)
+DEPS := $(OBJS:%.o=%.d)
+
+INC_DIRS := $(BUILD_DIR)/src
+INC_FLAGS := $(addprefix -I,$(INC_DIRS))
+
+override CFLAGS += \
+ -DG_LOG_DOMAIN='"Slirp"' \
+ $(shell $(PKG_CONFIG) --cflags glib-2.0) \
+ $(INC_FLAGS) \
+ -MMD -MP
+override LDFLAGS += $(shell $(PKG_CONFIG) --libs glib-2.0)
+
+$(LIBSLIRP): $(OBJS)
+
+.PHONY: clean
+
+clean:
+ rm -r $(OBJS) $(DEPS) $(LIBSLIRP)
+
+$(BUILD_DIR)/src/%.o: $(ROOT_DIR)/src/%.c
+ @$(MKDIR_P) $(dir $@)
+ $(call quiet-command,$(CC) $(CFLAGS) -c -o $@ $<,"CC","$@")
+
+%.a:
+ $(call quiet-command,rm -f $@ && $(AR) rcs $@ $^,"AR","$@")
+
+PKG_CONFIG ?= pkg-config
+MKDIR_P ?= mkdir -p
+quiet-command-run = $(if $(V),,$(if $2,printf " %-7s %s\n" $2 $3 && ))$1
+quiet-@ = $(if $(V),,@)
+quiet-command = $(quiet-@)$(call quiet-command-run,$1,$2,$3)
+
+print-%:
+ @echo '$*=$($*)'
+
+.SUFFIXES:
+
+-include $(DEPS)
--
2.20.1
- [Qemu-devel] [PULLv2 02/12] slirp: check for ioctlsocket error and 0-length udp payload., (continued)
- [Qemu-devel] [PULLv2 02/12] slirp: check for ioctlsocket error and 0-length udp payload., Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 03/12] slirp: check sscanf result when emulating ident, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 05/12] slirp: Mark pieces missing IPv6 support, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 08/12] slirp: use "slirp_" prefix for inet_aton() win32 implementation, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 04/12] slirp: fix big/little endian conversion in ident protocol, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 01/12] slirp: Fix build with gcc 9, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 07/12] slirp: use libslirp migration code, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 1/1] slirp: remove QEMU Makefile.objs, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 12/12] slirp: remove QEMU Makefile.objs, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 09/12] slirp: move sources to src/ subdirectory, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 10/12] slirp: add a standalone Makefile,
Samuel Thibault <=
- [Qemu-devel] [PULLv2 11/12] build-sys: link with slirp as an external project, Samuel Thibault, 2019/03/07
- [Qemu-devel] [PULLv2 06/12] slirp: adapt a subset of QEMU vmstate code, Samuel Thibault, 2019/03/07
- Re: [Qemu-devel] [PULLv2 00/12] slirp updates, Peter Maydell, 2019/03/08