diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-02-12 17:25:22 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2019-03-07 12:46:31 +0100 |
commit | 8fa3ab73574a4e0f3386c58bafb5c3891eeaeaee (patch) | |
tree | 8bf8c87ae49291ab1621fbbb44e17d7ba2541800 /Makefile | |
parent | 657aab83d99a6e116a13e1c586acc3b7320ecde3 (diff) | |
download | slirp-8fa3ab73574a4e0f3386c58bafb5c3891eeaeaee.zip slirp-8fa3ab73574a4e0f3386c58bafb5c3891eeaeaee.tar.gz slirp-8fa3ab73574a4e0f3386c58bafb5c3891eeaeaee.tar.bz2 |
slirp: add a standalone Makefile
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 <marcandre.lureau@redhat.com>
Message-Id: <20190212162524.31504-6-marcandre.lureau@redhat.com>
Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6d48f62 --- /dev/null +++ b/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) |