# (C) 2003 XDA Developers itsme@xs4all.nl # # $Header$ # out=../build obj=../build/synce ccincs=-I "../dll" -I "../include" -I "../common" CXX=g++-4.4 LDX=g++-4.4 cflags=-Wall -DUSING_SYNCE ldflags=-lcrypto -lboost_thread cflags+=-O0 -g ldflags+=-g libpaths= extralibs=-lrapi # these are used by all rapi based itsutils rapibase=ConfigApi.o FileFunctions.o appunlock.o checkdll.o debug.o streammultiplex.o stringutils.o findcert.o urapibase=uConfigApi.o uFileFunctions.o appunlock.o ucheckdll.o udebug.o streammultiplex.o ustringutils.o findcert.o .SUFFIXES: .SUFFIXES: .cpp .o define compile @$(CXX) $(cflags) $(cflags_$(basename $(notdir $1))) -c $(ccdefs) $(ccincs) $2 -o $1 endef $(obj)/%.o: %.cpp $(call compile,$@,$<) $(obj)/%.o: ../common/%.cpp $(call compile,$@,$<) $(out)/%: $(obj)/%.o @$(LDX) $(ldflags) $(ldflags_$(basename $(notdir $@))) $(libpaths) $(extralibs) $^ -o $@ all: $(obj) all2 debug: ifeq ($(n),) make DEBUG=1 else $(RM) ../build/$(n) mkdir -p ../build/w32dbg/ make ../build/$(n) DEBUG=1 endif $(obj): mkdir -p $(obj) define compilerule $(obj)/$1: $2 $$(call compile,$$@,$$<) endef # special rules ################################# define buildtarget APPLIST+=$1 CLEANLIST+=$(out)/$1 CLEANLIST+=$(addprefix $(obj)/,$2) $(out)/$1: $(addprefix $(obj)/,$2) endef define buildnptarget NPAPPLIST+=$1 CLEANLIST+=$(out)/$1 CLEANLIST+=$(addprefix $(obj)/,$2) $(out)/$1: $(addprefix $(obj)/,$2) endef define copyfile APPLIST+=$1 CLEANLIST+=$(out)/$1 $(out)/$1: $(out)/$2 cp $$^ $$@ endef #$(call buildtarget,tstaudio, tstaudio.o debug.o stringutils.o winmm.lib) define buildrules $(call compilerule,debugnorapi.o,../common/debug.cpp) cflags_debugnorapi=-D_NO_RAPI $(call compilerule,ustringutils.o,../common/stringutils.cpp) cflags_ustringutils=-D_UNICODE -DUNICODE $(call compilerule,ucsidlpaths.o,csidlpaths.cpp) cflags_ucsidlpaths=-D_UNICODE -DUNICODE $(call compilerule,ucheckdll.o,checkdll.cpp) cflags_ucheckdll=-D_UNICODE -DUNICODE $(call compilerule,udebug.o,../common/debug.cpp) cflags_udebug=-D_UNICODE -DUNICODE $(call compilerule,uConfigApi.o,ConfigApi.cpp) cflags_uConfigApi=-D_UNICODE -DUNICODE $(call compilerule,uFileFunctions.o,../common/FileFunctions.cpp) cflags_uFileFunctions=-D_UNICODE -DUNICODE $(call compilerule,ppostmsg.o,ppostmsg.cpp) cflags_ppostmsg=-DWINCEPOSTMSG $(call compilerule,postmsg.o,ppostmsg.cpp) cflags_postmsg=-DWIN32POSTMSG $(call compilerule,pmemdump.o,pmemdump.cpp) cflags_pmemdump=-DWINCEMEMDMP $(call compilerule,memdump.o,pmemdump.cpp) cflags_memdump=-DWIN32MEMDMP $(call compilerule,pregutl.o,pregutl.cpp) cflags_pregutl=-DWINCEREGUTL $(call compilerule,regutl.o,pregutl.cpp) cflags_regutl=-D_UNICODE -DUNICODE -DWIN32REGUTL $(call compilerule,sdread.o,psdread.cpp) cflags_sdread=-D_NO_RAPI $(call compilerule,psetmem.o,psetmem.cpp) cflags_psetmem=-DWINCESETMEM $(call compilerule,setmem.o,psetmem.cpp) cflags_setmem=-DWIN32SETMEM $(call copyfile,pget,pput) $(call copyfile,pdocwrite,pdocread) $(call copyfile,psdwrite,psdread) $(call copyfile,sdwrite,sdread) $(call copyfile,pflashrom,pnewbootloader) $(call buildtarget,dump, dump.o debug.o stringutils.o) cflags_dump=-D_USE_OPENSSL ldflags_dump=-lcrypto $(call buildtarget,tstimg, tstimg.o debug.o stringutils.o) #ldflags_tstimg=imagehlp.lib $(call buildtarget,pps, pps.o $(rapibase)) $(call buildtarget,pkill, pkill.o $(rapibase)) $(call buildtarget,psynctime, psynctime.o $(rapibase)) $(call buildtarget,preboot, preboot.o $(rapibase)) $(call buildtarget,pcoldboot, pcoldboot.o $(rapibase)) $(call buildtarget,ppostmsg, ppostmsg.o $(rapibase) vectorutils.o) $(call buildtarget,postmsg, postmsg.o debug.o stringutils.o vectorutils.o) $(call buildtarget,pdel, pdel.o csidlpaths.o $(rapibase)) $(call buildtarget,pmemdump, pmemdump.o $(rapibase)) $(call buildtarget,memdump, memdump.o $(rapibase) sysint-physmem.o) $(call buildnptarget,pcalladdr, pcalladdr.o $(rapibase)) $(call buildnptarget,pgsmbuf, pgsmbuf.o $(rapibase)) $(call buildtarget,pgsmdump, pgsmdump.o $(rapibase)) $(call buildtarget,pdblist, pdblist.o $(rapibase)) $(call buildtarget,pcontacts, pcontacts.o $(rapibase) vectorutils.o) $(call buildtarget,pdir, pdir.o ucsidlpaths.o $(urapibase)) cflags_pdir=-D_UNICODE -DUNICODE # c++0x #$ call buildtarget,getsigningcert, getsigningcert.o $(rapibase) $(call buildtarget,psendsms, psendsms.o stringutils.o $(rapibase)) $(call buildtarget,pdial, pdial.o stringutils.o $(rapibase)) $(call buildtarget,pmkdir, pmkdir.o csidlpaths.o $(rapibase)) $(call buildtarget,pmv, pmv.o csidlpaths.o $(rapibase)) $(call buildtarget,pchmod, pchmod.o csidlpaths.o $(rapibase)) $(call buildtarget,pput, pput.o ustringutils.o ucsidlpaths.o $(urapibase)) cflags_pput=-D_UNICODE -DUNICODE $(call buildtarget,pregdmp, pregdmp.o $(rapibase)) $(call buildtarget,pregutl, pregutl.o $(rapibase) vectorutils.o) $(call buildtarget,regutl, regutl.o $(urapibase) vectorutils.o) $(call buildtarget,prun, prun.o csidlpaths.o $(rapibase)) $(call buildtarget,prapi, prapi.o $(rapibase)) $(call buildtarget,pmemmap, pmemmap.o $(rapibase)) $(call buildtarget,phandle, phandle.o $(rapibase)) $(call buildtarget,pdebug, pdebug.o $(rapibase)) #cflags_pdebug=-D_BOOST_LITE $(call buildtarget,pdocread, pdocread.o $(rapibase)) $(call buildtarget,psdread, psdread.o $(rapibase)) $(call buildtarget,sdread, sdread.o debugnorapi.o stringutils.o) $(call buildtarget,psetmem, psetmem.o $(rapibase) vectorutils.o) $(call buildtarget,setmem, setmem.o $(rapibase) vectorutils.o sysint-physmem.o) $(call buildtarget,pcmon, pcmon.o debug.o stringutils.o) $(call buildtarget,pnewbmp, pnewbmp.o $(rapibase)) $(call buildtarget,xda2dmp, xda2dmp.o debug.o stringutils.o crc32.o) $(call buildtarget,pnewbootloader, pnewbootloader.o $(rapibase)) # findimg needs c++0x endef $(eval $(buildrules)) all2: $(addprefix $(out)/,$(APPLIST)) np: $(addprefix $(out)/,$(NPAPPLIST)) clean: rm -f $(CLEANLIST) ifndef DEBUG make clean DEBUG=1 endif dump.obj: dump.cpp dump_crc32.h dump_hash.h