mirror of
https://gitlab.com/qemu-project/capstone.git
synced 2025-09-17 02:01:15 +08:00
Makefile: put common functions into functions.mk
This commit is contained in:
9
Makefile
9
Makefile
@ -3,6 +3,7 @@
|
||||
|
||||
include config.mk
|
||||
include pkgconfig.mk # package version
|
||||
include functions.mk
|
||||
|
||||
# Verbose output?
|
||||
V ?= 0
|
||||
@ -373,19 +374,18 @@ else
|
||||
$(compile)
|
||||
endif
|
||||
|
||||
define compile
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
endef
|
||||
|
||||
define create-archive
|
||||
$(AR) q $(ARCHIVE) $(LIBOBJ)
|
||||
$(RANLIB) $(ARCHIVE)
|
||||
endef
|
||||
|
||||
|
||||
define create-library
|
||||
$(CC) $(LDFLAGS) $(LIBOBJ) -o $(LIBRARY)
|
||||
endef
|
||||
|
||||
|
||||
define generate-pkgcfg
|
||||
echo 'Name: capstone' > $(PKGCFGF)
|
||||
echo 'Description: Capstone disassembly engine' >> $(PKGCFGF)
|
||||
@ -397,6 +397,3 @@ define generate-pkgcfg
|
||||
echo 'Cflags: -I$${includedir}' >> $(PKGCFGF)
|
||||
endef
|
||||
|
||||
define log
|
||||
@printf " %-7s %s\n" "$(1)" "$(2)"
|
||||
endef
|
||||
|
12
functions.mk
Normal file
12
functions.mk
Normal file
@ -0,0 +1,12 @@
|
||||
# Capstone Disassembly Engine
|
||||
# Common functions used by Makefile & tests/Makefile
|
||||
|
||||
define compile
|
||||
${CC} ${CFLAGS} -c $< -o $@
|
||||
endef
|
||||
|
||||
|
||||
define log
|
||||
@printf " %-7s %s\n" "$(1)" "$(2)"
|
||||
endef
|
||||
|
@ -2,6 +2,7 @@
|
||||
# By Nguyen Anh Quynh <aquynh@gmail.com>, 2013-2014
|
||||
|
||||
include ../config.mk
|
||||
include ../functions.mk
|
||||
|
||||
# Verbose output?
|
||||
V ?= 0
|
||||
@ -112,20 +113,15 @@ else
|
||||
$(compile)
|
||||
endif
|
||||
|
||||
define compile
|
||||
${CC} ${CFLAGS} -c $< -o $@
|
||||
endef
|
||||
|
||||
define link-dynamic
|
||||
${CC} $(CFLAGS) $(LDFLAGS) $< -O3 -Wall -l$(LIBNAME) -o $@
|
||||
endef
|
||||
|
||||
|
||||
define link-static
|
||||
${CC} $(CFLAGS) $(LDFLAGS) $< -O3 -Wall $(LIBDIR)/lib$(LIBNAME).$(AR_EXT) -o $(call staticname,$@)
|
||||
endef
|
||||
|
||||
define log
|
||||
@printf " %-7s %s\n" "$(1)" "$(2)"
|
||||
endef
|
||||
|
||||
staticname = $(subst $(BIN_EXT),,$(1)).static$(BIN_EXT)
|
||||
|
Reference in New Issue
Block a user