Implement compilation modes

These default to "Debug" and "Release" modes.
This commit is contained in:
Pierre Pronchery 2022-04-30 03:57:24 +02:00
parent f566d43087
commit 6f232c2f36
7 changed files with 197 additions and 146 deletions

View File

@ -6,6 +6,13 @@ subdirs=data,doc,include,src,tools,tests
targets=tests
dist=Makefile,COPYING,config.ent,config.h,config.sh
#modes
[mode::debug]
title=Debug
[mode::release]
title=Release
#targets
[tests]
type=command

View File

@ -5,169 +5,178 @@ cflags=-W -Wall -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
ldflags_force=`pkg-config --libs libSystem`
dist=Makefile,amd64.ins,amd64.pre,amd64.reg,arm.h,arm.ins,arm.reg,common.ins,dalvik.ins,dalvik.reg,eth.ins,i386.def,i386.h,i386.ins,i386.pre,i386.reg,i486.ins,i586.ins,i686.ins,i686.reg,mips.h,mips.ins,mips.reg,null.ins,null.pre,null.reg,sparc.h,sparc.ins,sparc.reg,yasep.h,yasep.ins,yasep.reg
#modes
[mode::debug]
[mode::release]
cppflags_force=-I../../include -DNDEBUG
cflags=-W -Wall -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
#targets
[amd64]
type=plugin
sources=amd64.c
install=$(LIBDIR)/Asm/arch
[amd64.c]
depends=amd64.ins,amd64.pre,amd64.reg,common.ins,i386.h,i386.ins,i386.pre,i386.reg,i486.ins,i686.ins,i686.reg,null.ins,null.pre
[arm]
type=plugin
sources=arm.c
install=$(LIBDIR)/Asm/arch
[arm.c]
depends=arm.h,arm.ins,arm.reg,common.ins,null.ins
[armeb]
type=plugin
sources=armeb.c
install=$(LIBDIR)/Asm/arch
[armeb.c]
depends=$(OBJDIR)arm.o
[armel]
type=plugin
sources=armel.c
install=$(LIBDIR)/Asm/arch
[armel.c]
depends=$(OBJDIR)arm.o
[dalvik]
type=plugin
sources=dalvik.c
install=$(LIBDIR)/Asm/arch
[dalvik.c]
depends=common.ins,dalvik.ins,dalvik.reg,null.ins
[eth]
type=plugin
sources=eth.c
install=$(LIBDIR)/Asm/arch
[eth.c]
depends=common.ins,eth.ins,null.ins
[i386]
type=plugin
sources=i386.c
install=$(LIBDIR)/Asm/arch
[i386.c]
depends=common.ins,i386.def,i386.h,i386.ins,i386.pre,i386.pre,i386.reg,null.ins,null.pre
[i386_real]
type=plugin
sources=i386_real.c
install=$(LIBDIR)/Asm/arch
[i386_real.c]
depends=common.ins,i386.h,i386.ins,i386.pre,i386.reg,null.ins,null.pre
[i486]
type=plugin
sources=i486.c
install=$(LIBDIR)/Asm/arch
[i486.c]
depends=common.ins,i386.def,i386.h,i386.ins,i386.pre,i386.reg,i486.ins,null.ins,null.pre
[i586]
type=plugin
sources=i586.c
install=$(LIBDIR)/Asm/arch
[i586.c]
depends=common.ins,i386.def,i386.h,i386.ins,i386.pre,i386.reg,i486.ins,i586.ins,null.ins,null.pre
[i686]
type=plugin
sources=i686.c
install=$(LIBDIR)/Asm/arch
[i686.c]
depends=common.ins,i386.def,i386.h,i386.ins,i386.pre,i386.reg,i486.ins,i686.ins,i686.reg,null.ins,null.pre
[java]
type=plugin
sources=java.c
install=$(LIBDIR)/Asm/arch
[java.c]
depends=common.ins,null.ins
[mips]
type=plugin
sources=mips.c
install=$(LIBDIR)/Asm/arch
[mips.c]
depends=common.ins,mips.h,mips.ins,mips.reg,null.ins
[mipseb]
type=plugin
sources=mipseb.c
install=$(LIBDIR)/Asm/arch
[mipseb.c]
depends=$(OBJDIR)mips.o
[mipsel]
type=plugin
sources=mipsel.c
install=$(LIBDIR)/Asm/arch
[mipsel.c]
depends=$(OBJDIR)mips.o
[sparc]
type=plugin
sources=sparc.c
install=$(LIBDIR)/Asm/arch
[sparc.c]
depends=common.ins,null.ins,sparc.h,sparc.ins,sparc.reg
[sparc64]
type=plugin
sources=sparc64.c
install=$(LIBDIR)/Asm/arch
[sparc64.c]
depends=common.ins,null.ins,sparc.h,sparc.ins,sparc.reg
[template]
type=plugin
sources=template.c
[template.c]
depends=common.ins,null.ins,null.pre
[yasep]
type=plugin
sources=yasep.c
install=$(LIBDIR)/Asm/arch
[yasep.c]
depends=common.ins,null.ins,yasep.h,yasep.ins,yasep.reg
[yasep16]
type=plugin
sources=yasep16.c
install=$(LIBDIR)/Asm/arch
[yasep16.c]
depends=common.ins,null.ins,yasep.c,yasep.h,yasep.ins,yasep.reg
[yasep32]
type=plugin
sources=yasep32.c
install=$(LIBDIR)/Asm/arch
#sources
[amd64.c]
depends=amd64.ins,amd64.pre,amd64.reg,common.ins,i386.h,i386.ins,i386.pre,i386.reg,i486.ins,i686.ins,i686.reg,null.ins,null.pre
[arm.c]
depends=arm.h,arm.ins,arm.reg,common.ins,null.ins
[armeb.c]
depends=$(OBJDIR)arm.o
[armel.c]
depends=$(OBJDIR)arm.o
[dalvik.c]
depends=common.ins,dalvik.ins,dalvik.reg,null.ins
[eth.c]
depends=common.ins,eth.ins,null.ins
[i386.c]
depends=common.ins,i386.def,i386.h,i386.ins,i386.pre,i386.pre,i386.reg,null.ins,null.pre
[i386_real.c]
depends=common.ins,i386.h,i386.ins,i386.pre,i386.reg,null.ins,null.pre
[i486.c]
depends=common.ins,i386.def,i386.h,i386.ins,i386.pre,i386.reg,i486.ins,null.ins,null.pre
[i586.c]
depends=common.ins,i386.def,i386.h,i386.ins,i386.pre,i386.reg,i486.ins,i586.ins,null.ins,null.pre
[i686.c]
depends=common.ins,i386.def,i386.h,i386.ins,i386.pre,i386.reg,i486.ins,i686.ins,i686.reg,null.ins,null.pre
[java.c]
depends=common.ins,null.ins
[mips.c]
depends=common.ins,mips.h,mips.ins,mips.reg,null.ins
[mipseb.c]
depends=$(OBJDIR)mips.o
[mipsel.c]
depends=$(OBJDIR)mips.o
[sparc.c]
depends=common.ins,null.ins,sparc.h,sparc.ins,sparc.reg
[sparc64.c]
depends=common.ins,null.ins,sparc.h,sparc.ins,sparc.reg
[template.c]
depends=common.ins,null.ins,null.pre
[yasep.c]
depends=common.ins,null.ins,yasep.h,yasep.ins,yasep.reg
[yasep16.c]
depends=common.ins,null.ins,yasep.c,yasep.h,yasep.ins,yasep.reg
[yasep32.c]
depends=common.ins,null.ins,yasep.c,yasep.h,yasep.ins,yasep.reg

View File

@ -5,6 +5,14 @@ cflags=-W -Wall -g -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
ldflags_force=`pkg-config --libs libSystem`
dist=Makefile,elf/common.h,elf/elf.h,elf/elf.c
#modes
[mode::debug]
[mode::release]
cppflags_force=-I../../include -DNDEBUG
cflags=-W -Wall -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
#targets
[dex]
type=plugin
sources=dex.c
@ -15,18 +23,6 @@ type=plugin
sources=elf.c,elf/common.c,elf/elf32.c,elf/elf64.c
install=$(LIBDIR)/Asm/format
[elf.c]
depends=elf/common.h
[elf/common.c]
depends=elf/common.h
[elf/elf32.c]
depends=elf/common.h,elf/elf.h,elf/elf.c
[elf/elf64.c]
depends=elf/common.h,elf/elf.h,elf/elf.c
[flat]
type=plugin
sources=flat.c
@ -46,3 +42,16 @@ install=$(LIBDIR)/Asm/format
type=plugin
sources=pe.c
install=$(LIBDIR)/Asm/format
#sources
[elf.c]
depends=elf/common.h
[elf/common.c]
depends=elf/common.h
[elf/elf32.c]
depends=elf/common.h,elf/elf.h,elf/elf.c
[elf/elf64.c]
depends=elf/common.h,elf/elf.h,elf/elf.c

View File

@ -8,6 +8,13 @@ ldflags_force=`pkg-config --libs cpp`
ldflags=-ldl -Wl,-z,relro -Wl,-z,now
dist=Makefile,arch.h,code.h,common.h,format.h,parser.h,token.h,python/project.conf,python/Makefile,python/libAsm.c,python/libAsm.py
#modes
[mode::debug]
[mode::release]
cppflags_force=-I../include -DNDEBUG
cflags=-W -Wall -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
[libAsm]
type=library
sources=arch.c,asm.c,code.c,format.c,parser.c,token.c

View File

@ -5,6 +5,14 @@ ldflags_force=`pkg-config --libs python-2.7 cpp` -lAsm
ldflags=-L$(OBJDIR).. -Wl,-rpath,$(LIBDIR)
dist=Makefile,libAsm.py
#modes
[mode::debug]
[mode::release]
cppflags_force=-DNDEBUG
cflags=-W -Wall -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
#targets
[_libAsm]
type=plugin
sources=libAsm.c

View File

@ -2,38 +2,27 @@ targets=amd64.o,arm.o,armeb.o,armel.o,coverage.log,clint.log,dalvik.o,eth.o,fixm
as=$(OBJDIR)../tools/asm-static
dist=Makefile,clint.sh,coverage.sh,fixme.sh,pylint.sh,python.sh,tests.sh
#targets
[amd64.o]
type=object
asflags=-a amd64
sources=amd64.asm
[amd64.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[arm.o]
type=object
asflags=-a arm
sources=arm.asm
[arm.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[armeb.o]
type=object
asflags=-a armeb
sources=armeb.asm
[armeb.asm]
depends=arm.asm,$(OBJDIR)../tools/asm-static$(EXEEXT)
[armel.o]
type=object
asflags=-a armel
sources=armel.asm
[armel.asm]
depends=arm.asm,$(OBJDIR)../tools/asm-static$(EXEEXT)
[clint.log]
type=script
script=./clint.sh
@ -52,17 +41,11 @@ type=object
asflags=-a dalvik -f flat
sources=dalvik.asm
[dalvik.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[eth.o]
type=object
asflags=-a eth
sources=eth.asm
[eth.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[fixme.log]
type=script
script=./fixme.sh
@ -74,73 +57,46 @@ type=object
asflags=-a i386
sources=i386.asm
[i386.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[i386_real.o]
type=object
asflags=-a i386_real -f mbr
sources=i386_real.asm
[i386_real.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[i486.o]
type=object
asflags=-a i486
sources=i486.asm
[i486.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[i586.o]
type=object
asflags=-a i586
sources=i586.asm
[i586.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[i686.o]
type=object
asflags=-a i686
sources=i686.asm
[i686.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[java.o]
type=object
asflags=-a java -f flat
sources=java.asm
[java.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[mips.o]
type=object
asflags=-a mips
sources=mips.asm
[mips.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[mipseb.o]
type=object
asflags=-a mipseb
sources=mipseb.asm
[mipseb.asm]
depends=mips.asm,$(OBJDIR)../tools/asm-static$(EXEEXT)
[mipsel.o]
type=object
asflags=-a mipsel
sources=mipsel.asm
[mipsel.asm]
depends=mips.asm,$(OBJDIR)../tools/asm-static$(EXEEXT)
[pylint.log]
type=script
script=./pylint.sh
@ -152,25 +108,16 @@ type=object
asflags=-a sparc
sources=sparc.asm
[sparc.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[sparc64.o]
type=object
asflags=-a sparc64
sources=sparc64.asm
[sparc64.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[template.o]
type=object
asflags=-a template -f flat
sources=template.asm
[template.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[tests.log]
type=script
script=./tests.sh
@ -183,21 +130,76 @@ type=object
asflags=-a yasep -f flat
sources=yasep.asm
[yasep.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[yasep16.o]
type=object
asflags=-a yasep16 -f flat
sources=yasep16.asm
[yasep16.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT),yasep.asm
[yasep32.o]
type=object
asflags=-a yasep32 -f flat
sources=yasep32.asm
#sources
[amd64.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[arm.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[armeb.asm]
depends=arm.asm,$(OBJDIR)../tools/asm-static$(EXEEXT)
[armel.asm]
depends=arm.asm,$(OBJDIR)../tools/asm-static$(EXEEXT)
[dalvik.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[eth.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[i386.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[i386_real.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[i486.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[i586.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[i686.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[java.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[mips.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[mipseb.asm]
depends=mips.asm,$(OBJDIR)../tools/asm-static$(EXEEXT)
[mipsel.asm]
depends=mips.asm,$(OBJDIR)../tools/asm-static$(EXEEXT)
[sparc.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[sparc64.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[template.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[yasep.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT)
[yasep16.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT),yasep.asm
[yasep32.asm]
depends=$(OBJDIR)../tools/asm-static$(EXEEXT),yasep.asm

View File

@ -6,11 +6,30 @@ ldflags_force=`pkg-config --libs cpp`
ldflags=-Wl,-z,relro -Wl,-z,now
dist=Makefile
#modes
[mode::debug]
[mode::release]
cppflags_force=-I../include -DNDEBUG
cflags=-W -Wall -O2 -D_FORTIFY_SOURCE=2 -fstack-protector
#targets
[libAsm]
type=library
sources=arch.c,arch/amd64.c,arch/arm.c,arch/armeb.c,arch/armel.c,arch/dalvik.c,arch/eth.c,arch/i386.c,arch/i386_real.c,arch/i486.c,arch/i586.c,arch/i686.c,arch/java.c,arch/mips.c,arch/mipseb.c,arch/mipsel.c,arch/sparc.c,arch/sparc64.c,arch/template.c,arch/yasep.c,arch/yasep16.c,arch/yasep32.c,format.c,format/dex.c,format/elf.c,format/elf/elf32.c,format/elf/elf64.c,format/flat.c,format/java.c,format/mbr.c,format/pe.c,asm.c,code.c,parser.c,token.c
cflags=-fPIC
[asm-static]
type=binary
depends=$(OBJDIR)../src/main.o,$(OBJDIR)libAsm.a
ldflags=$(OBJDIR)../src/main.o $(OBJDIR)libAsm.a -pie
[deasm-static]
type=binary
depends=$(OBJDIR)../src/deasm.o,$(OBJDIR)libAsm.a
ldflags=$(OBJDIR)../src/deasm.o $(OBJDIR)libAsm.a -pie
#sources
[arch.c]
depends=../src/arch.c
@ -49,13 +68,3 @@ depends=../src/parser.c
[token.c]
depends=../src/token.c
[asm-static]
type=binary
depends=$(OBJDIR)../src/main.o,$(OBJDIR)libAsm.a
ldflags=$(OBJDIR)../src/main.o $(OBJDIR)libAsm.a -pie
[deasm-static]
type=binary
depends=$(OBJDIR)../src/deasm.o,$(OBJDIR)libAsm.a
ldflags=$(OBJDIR)../src/deasm.o $(OBJDIR)libAsm.a -pie