samples: clean executable binaries before building

This commit is contained in:
Nguyen Anh Quynh 2016-03-25 22:29:50 +08:00
parent 5995c95f23
commit 3bb05fa8e9

View File

@ -75,7 +75,7 @@ ARCHIVE = $(LIBDIR)/lib$(LIBNAME).$(AR_EXT)
endif
endif
.PHONY: all clean
.PHONY: all clean clean_bins clean_libs
UNICORN_ARCHS := $(shell if [ -e ../config.log ]; then cat ../config.log;\
else printf "$(UNICORN_ARCHS)"; fi)
@ -109,13 +109,17 @@ OBJS = $(addprefix $(OBJDIR)/,$(SOURCES:.c=.o))
OBJS_ELF = $(addprefix $(OBJDIR)/,$(SOURCES:.c=))
BINARY = $(addprefix $(SAMPLEDIR)/,$(SOURCES:.c=$(BIN_EXT)))
all: $(BINARY)
all: clean_bins $(BINARY)
clean:
clean_bins:
rm -rf *.o $(OBJS_ELF) $(BINARY) $(SAMPLEDIR)/*.exe $(SAMPLEDIR)/*.static $(OBJDIR)/lib$(LIBNAME)* $(OBJDIR)/$(LIBNAME)*
rm -rf libunicorn*.so libunicorn*.lib libunicorn*.dylib unicorn*.dll unicorn*.lib
rm -rf sample_x86 sample_arm sample_arm64 sample_mips sample_sparc sample_ppc sample_m68k shellcode mem_apis
clean_libs:
rm -rf libunicorn*.so libunicorn*.lib libunicorn*.dylib unicorn*.dll unicorn*.lib
clean: clean_bins clean_libs
$(BINARY): $(OBJS)
$(SAMPLEDIR)/%$(BIN_EXT): $(OBJDIR)/%.o