diff options
author | toni <toni@devlap.local> | 2015-02-28 03:48:15 +0100 |
---|---|---|
committer | toni <toni@devlap.local> | 2015-02-28 03:48:15 +0100 |
commit | 817e020d34b6d1c0a37ab4987669564c8ce0b71e (patch) | |
tree | ee48ca4ad0677ce90195eb9d5dfddd7c9d2d1724 /crypter/Makefile | |
parent | 3a8090d5a8feb5af7ec9120c6976005a5b86392b (diff) | |
parent | 63570f58baad9dbbfe7fd7226f48870d43cf9ccf (diff) |
Merge branch 'master' of github.com:freecoding/bufflow
Conflicts:
crypter/Makefile
Diffstat (limited to 'crypter/Makefile')
-rw-r--r-- | crypter/Makefile | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/crypter/Makefile b/crypter/Makefile index 5b1b5d6..f64183f 100644 --- a/crypter/Makefile +++ b/crypter/Makefile @@ -4,12 +4,17 @@ CC := gcc LD := ld XXD := xxd ASMFLAGS = -g -CFLAGS = -Wall -fpic -Os -LDFLAGS = +CFLAGS ?= -Wall -fpic -Os +X86_FLAGS := -m32 +X64_FLAGS := -m64 +LDFLAGS ?= SUBDIR ?= . -TARGETS = $(patsubst %.asm,%.o,$(wildcard $(SUBDIR)/*.asm)) $(patsubst %.c,%.o,$(wildcard $(SUBDIR)/*.c)) +TARGETS := $(patsubst %.asm,%.o,$(wildcard $(SUBDIR)/*.asm)) $(patsubst %.c,%,$(wildcard $(SUBDIR)/*.c)) +SOURCES_ASM := $(wildcard $(SUBDIR)/*.asm) +SOURCES_C := $(wildcard $(SUBDIR)/*.c) SCDIR ?= .. SCC := $(shell if [ -x $(SCDIR)/sc-test ]; then echo "yes"; else echo "no"; fi) +LBITS := $(shell getconf LONG_BIT) all: $(TARGETS) @@ -17,17 +22,20 @@ all: $(TARGETS) %.o : %.asm $(ASM) $(ASMFLAGS) -o $@ $< -%.o : %.c +% : %.c ifneq ($(SCC),yes) - $(error Please run 'make' in the main directory) + $(error Please run 'make' first in the main directory) endif - @echo "generating header $(patsubst %.o,%.h,$@) for target $<" + @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,$@)) - $(CC) $(CFLAGS) -D_USE_CFG -o $(patsubst %.c,%,$<) $< + $(CC) $(CFLAGS) $(X86_FLAGS) -D_USE_CFG -o $(patsubst %.c,%,$<) $< +ifeq ($(LBITS),64) + $(CC) $(CFLAGS) $(X64_FLAGS) -D_USE_CFG -o $(patsubst %.c,%_x64,$<) $< +endif clean: - $(RM) -f $(patsubst %.o,%,$(TARGETS)) $(TARGETS) $(patsubst %.o,%.h,$(TARGETS)) - $(RM) -f *.o + $(RM) -f $(patsubst %.c,%,$(SOURCES_C)) $(patsubst %.c,%_x64,$(SOURCES_C)) + $(RM) -f $(patsubst %.asm,%.o,$(SOURCES_ASM)) .PHONY: all clean |