From 0bb1d064a677fb50281b14ea13a2ec7fb7eb978e Mon Sep 17 00:00:00 2001 From: Julian Kranz Date: Thu, 24 Jul 2014 19:16:21 +0200 Subject: [PATCH] Manual Makefiles: Bug fixes --- avr.mk | 2 +- libs/Makefile | 16 ++++++++++------ libs/gdwrap/Makefile | 5 +++-- libs/jgdsl/Makefile | 3 --- libs/rreil-sim/Makefile | 7 ++++--- libs/rreil/Makefile | 5 +++-- tools/Makefile | 9 ++++----- x86.mk | 2 +- 8 files changed, 26 insertions(+), 23 deletions(-) diff --git a/avr.mk b/avr.mk index 20f826f7..1fc941ea 100644 --- a/avr.mk +++ b/avr.mk @@ -1 +1 @@ -export GDSL_AVR=1 +export GDSL_ARCH=avr diff --git a/libs/Makefile b/libs/Makefile index 667dbd94..3df37de7 100644 --- a/libs/Makefile +++ b/libs/Makefile @@ -1,14 +1,18 @@ LIBS=gdutil gdsl-multiplex gdwrap readhex rreil jgdsl cppgdsl -#ifndef MANAGED -#GDSL_AVR:=1 -#GDSL_X86:=1 -#endif +#eq = $(and $(findstring $(1),$(2)),$(findstring $(2),$(1))) +#$(if $(call eq,$GDSL_ARCH,x86), \ +#LIBS+=x86 x86-tester x86-generator \ +#) -ifdef GDSL_X86 -LIBS+=x86 x86-tester x86-generator +ifeq ($(GDSL_ARCH),x86) +LIBS+=x86 x86-tester x86-generator endif +#$(info $(call eq,x86,99)) + +$(info $(LIBS)) + .PHONY all: $(LIBS) $(LIBS): diff --git a/libs/gdwrap/Makefile b/libs/gdwrap/Makefile index eb7b1ed9..d5b041ce 100644 --- a/libs/gdwrap/Makefile +++ b/libs/gdwrap/Makefile @@ -5,8 +5,9 @@ INCDS=-Iinclude -I$(MLTK)/include DEFINES=-DRELAXEDFATAL -ifdef GDSL_X86 -DEFINES+=-DGDSL_X86 +ifdef GDSL_ARCH +UPPER_ARCH = $(shell echo $(GDSL_ARCH) | tr a-z A-Z) +DEFINES+=-DGDSL_$(UPPER_ARCH) endif CFLAGS=-c -g3 -std=c11 -pedantic -Wall -Wfatal-errors $(DEFINES) $(INCDS) diff --git a/libs/jgdsl/Makefile b/libs/jgdsl/Makefile index 30ef227f..57e2c2a6 100644 --- a/libs/jgdsl/Makefile +++ b/libs/jgdsl/Makefile @@ -7,9 +7,6 @@ LIBFLAGS=$(LIBDS) $(LIBS) INCDS=-Iinclude -I$(MLTK)/include DEFINES=-DRELAXEDFATAL -ifdef GDSL_X86 -DEFINES+=-DGDSL_X86 -endif CFLAGS=-std=c11 -g3 -fPIC -shared -pedantic -Wall -Wfatal-errors $(DEFINES) $(INCDS) diff --git a/libs/rreil-sim/Makefile b/libs/rreil-sim/Makefile index 6d2ba240..161daec4 100644 --- a/libs/rreil-sim/Makefile +++ b/libs/rreil-sim/Makefile @@ -4,9 +4,10 @@ CC=gcc INCDS=-Iinclude -I$(MLTK)/include DEFINES=-DRELAXEDFATAL -#ifdef GDSL_X86 -DEFINES+=-DGDSL_X86 -#endif +ifdef GDSL_ARCH +UPPER_ARCH = $(shell echo $(GDSL_ARCH) | tr a-z A-Z) +DEFINES+=-DGDSL_$(UPPER_ARCH) +endif CFLAGS=-c -g3 -std=c11 -pedantic -Wall -Wfatal-errors $(DEFINES) $(INCDS) diff --git a/libs/rreil/Makefile b/libs/rreil/Makefile index 8058af1b..f0bc9517 100644 --- a/libs/rreil/Makefile +++ b/libs/rreil/Makefile @@ -4,8 +4,9 @@ CC=gcc INCDS=-Iinclude -I$(MLTK)/include DEFINES=-DRELAXEDFATAL -ifdef GDSL_X86 -DEFINES+=-DGDSL_X86 +ifdef GDSL_ARCH +UPPER_ARCH = $(shell echo $(GDSL_ARCH) | tr a-z A-Z) +DEFINES+=-DGDSL_$(UPPER_ARCH) endif CFLAGS=-c -g3 -std=c11 -pedantic -Wall -Wfatal-errors $(DEFINES) $(INCDS) diff --git a/tools/Makefile b/tools/Makefile index 68465d09..2c69b7a9 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -14,12 +14,11 @@ LIBDS=-L../lib #$(info $(MANAGED)) DEFINES=-DRELAXEDFATAL -ifdef GDSL_X86 -DEFINES+=-DGDSL_X86 +ifdef GDSL_ARCH +UPPER_ARCH = $(shell echo $(GDSL_ARCH) | tr a-z A-Z) +DEFINES+=-DGDSL_$(UPPER_ARCH) endif -ifdef GDSL_X86 -endif LIBS +=-lgdsl -lrt -lreadhex -lgdsl-multiplex -ldl -lgdutil -lelf LIBS_MULT +=-lrt -lreadhex -lgdsl-multiplex -ldl -lgdutil -lelf @@ -94,7 +93,7 @@ liveness-sweep: liveness-sweep.o liveness-sweep.o: liveness-sweep.c $(CC) $(CFLAGS) liveness-sweep.c -o $@ -ifdef GDSL_X86 +ifeq ($(GDSL_ARCH),x86) ### x86-test-runner x86-test-runner: $(MAKE) -C $@ diff --git a/x86.mk b/x86.mk index 4946b532..3d41db3e 100644 --- a/x86.mk +++ b/x86.mk @@ -1 +1 @@ -export GDSL_X86=1 +export GDSL_ARCH=x86