From 15fbdd7e155e5181de6a82c34e419488bc9626d0 Mon Sep 17 00:00:00 2001 From: toni Date: Wed, 4 Mar 2015 18:59:52 +0100 Subject: - Makefile: new target 'debug' --- Makefile | 7 +++++-- crypter/Makefile | 7 ++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index dbb5a92..145ddf4 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,8 @@ RM := rm CC := gcc STRIP := strip LBITS := $(shell getconf LONG_BIT) -CFLAGS = -Wall -g -OCFLAGS = -z execstack -fno-stack-protector +CFLAGS += -Wall +OCFLAGS += -z execstack -fno-stack-protector X86_FLAGS = -m32 -mpreferred-stack-boundary=2 X64_FLAGS = -m64 -mpreferred-stack-boundary=4 SOURCES = $(wildcard *.c) @@ -15,6 +15,9 @@ all: $(TARGETS) shellcode crypter main: $(TARGETS) +debug: + $(MAKE) -C . CFLAGS="-g" + shellcode: $(MAKE) -C shellcode all diff --git a/crypter/Makefile b/crypter/Makefile index f64183f..db2b296 100644 --- a/crypter/Makefile +++ b/crypter/Makefile @@ -4,7 +4,7 @@ CC := gcc LD := ld XXD := xxd ASMFLAGS = -g -CFLAGS ?= -Wall -fpic -Os +CFLAGS += -fpic -Os X86_FLAGS := -m32 X64_FLAGS := -m64 LDFLAGS ?= @@ -27,8 +27,8 @@ ifneq ($(SCC),yes) $(error Please run 'make' first in the main directory) endif @echo "generating header $(patsubst %.c,%.h,$<) for target $<" - -$(shell $(SCDIR)/sc-test -p $(SUBDIR)/`cat "$<" | sed -n 's/.*#DECODER=//p'` | sed 's/shellcode/decoder/' > $(patsubst %.o,%.h,$@)) - -$(shell $(SCDIR)/sc-test -p $(SUBDIR)/`cat "$<" | sed -n 's/.*#SHELLCODE=//p'` >> $(patsubst %.o,%.h,$@)) + -$(shell $(SCDIR)/sc-test -p $(SUBDIR)/`cat "$<" | sed -n 's/.*#DECODER=//p'` | sed 's/shellcode/decoder/' > $(patsubst %.c,%.h,$<)) + -$(shell $(SCDIR)/sc-test -p $(SUBDIR)/`cat "$<" | sed -n 's/.*#SHELLCODE=//p'` >> $(patsubst %.c,%.h,$<)) $(CC) $(CFLAGS) $(X86_FLAGS) -D_USE_CFG -o $(patsubst %.c,%,$<) $< ifeq ($(LBITS),64) $(CC) $(CFLAGS) $(X64_FLAGS) -D_USE_CFG -o $(patsubst %.c,%_x64,$<) $< @@ -36,6 +36,7 @@ endif clean: $(RM) -f $(patsubst %.c,%,$(SOURCES_C)) $(patsubst %.c,%_x64,$(SOURCES_C)) + $(RM) -f $(patsubst %.c,%.h,$(SOURCES_C)) $(RM) -f $(patsubst %.asm,%.o,$(SOURCES_ASM)) .PHONY: all clean -- cgit v1.2.3