1766a487aSbellardARCH=i386 2766a487aSbellard#ARCH=ppc 3367e86e8SbellardHOST_CC=gcc 4766a487aSbellard 5766a487aSbellardifeq ($(ARCH),i386) 6367e86e8SbellardCFLAGS=-Wall -O2 -g -fomit-frame-pointer 731e31b8aSbellardLDFLAGS=-g 8766a487aSbellardLIBS= 9766a487aSbellardCC=gcc 10766a487aSbellardDEFINES=-DHAVE_BYTESWAP_H 11927f621eSbellardOP_CFLAGS=$(CFLAGS) -malign-functions=0 -mpreferred-stack-boundary=2 12766a487aSbellardendif 13766a487aSbellard 14766a487aSbellardifeq ($(ARCH),ppc) 15766a487aSbellardGCC_LIBS_DIR=/usr/netgem/tools/lib/gcc-lib/powerpc-linux/2.95.2 16766a487aSbellardDIST=/home/fbe/nsv/dist/hw/n6-dtt 17766a487aSbellardCC=powerpc-linux-gcc -msoft-float 18766a487aSbellardCFLAGS=-Wall -pipe -O2 -mcpu=405 -mbig -nostdinc -g -I$(GCC_LIBS_DIR)/include -I$(DIST)/include 19766a487aSbellardLIBS_DIR=$(DIST)/lib 20766a487aSbellardCRT1=$(LIBS_DIR)/crt1.o 21766a487aSbellardCRTI=$(LIBS_DIR)/crti.o 22766a487aSbellardCRTN=$(LIBS_DIR)/crtn.o 23766a487aSbellardCRTBEGIN=$(GCC_LIBS_DIR)/crtbegin.o 24766a487aSbellardCRTEND=$(GCC_LIBS_DIR)/crtend.o 25766a487aSbellardLDFLAGS=-static -g -nostdlib $(CRT1) $(CRTI) $(CRTBEGIN) 26766a487aSbellardLIBS=-L$(LIBS_DIR) -ltinyc -lgcc $(CRTEND) $(CRTN) 27766a487aSbellardDEFINES=-Dsocklen_t=int 28927f621eSbellardOP_CFLAGS=$(CFLAGS) 29766a487aSbellardendif 30766a487aSbellard 31766a487aSbellard######################################################### 32766a487aSbellard 330ecfa993SbellardDEFINES+=-D_GNU_SOURCE 34367e86e8SbellardDEFINES+=-DCONFIG_PREFIX=\"/usr/local\" 35766a487aSbellardLDSCRIPT=$(ARCH).ld 36927f621eSbellardLIBS+=-ldl -lm 37586314f2SbellardVERSION=0.1 3831e31b8aSbellard 39586314f2SbellardOBJS= elfload.o main.o thunk.o syscall.o 40367e86e8SbellardOBJS+=translate-i386.o op-i386.o 410ecfa993Sbellard# NOTE: the disassembler code is only needed for debugging 420ecfa993SbellardOBJS+=i386-dis.o dis-buf.o 4331e31b8aSbellardSRCS = $(OBJS:.o=.c) 4431e31b8aSbellard 4531e31b8aSbellardall: gemu 4631e31b8aSbellard 4731e31b8aSbellardgemu: $(OBJS) 48367e86e8Sbellard $(CC) -Wl,-T,$(LDSCRIPT) $(LDFLAGS) -o $@ $^ $(LIBS) 4931e31b8aSbellard 5031e31b8aSbellarddepend: $(SRCS) 5131e31b8aSbellard $(CC) -MM $(CFLAGS) $^ 1>.depend 5231e31b8aSbellard 53367e86e8Sbellard# new i386 emulator 54367e86e8Sbellarddyngen: dyngen.c 55367e86e8Sbellard $(HOST_CC) -O2 -Wall -g $< -o $@ 56367e86e8Sbellard 57367e86e8Sbellardtranslate-i386.o: translate-i386.c op-i386.h cpu-i386.h 58367e86e8Sbellard 59367e86e8Sbellardop-i386.h: op-i386.o dyngen 60367e86e8Sbellard ./dyngen -o $@ $< 61367e86e8Sbellard 62367e86e8Sbellardop-i386.o: op-i386.c opreg_template.h ops_template.h 63927f621eSbellard $(CC) $(OP_CFLAGS) $(DEFINES) -c -o $@ $< 64367e86e8Sbellard 6531e31b8aSbellard%.o: %.c 6631e31b8aSbellard $(CC) $(CFLAGS) $(DEFINES) -c -o $@ $< 6731e31b8aSbellard 6831e31b8aSbellardclean: 69586314f2Sbellard rm -f *.o *~ gemu dyngen TAGS 7031e31b8aSbellard 71367e86e8Sbellard# various test targets 72367e86e8Sbellardtest speed: gemu 73367e86e8Sbellard make -C tests $@ 7431e31b8aSbellard 75367e86e8SbellardTAGS: 76367e86e8Sbellard etags *.[ch] i386/*.[ch] 7731e31b8aSbellard 78586314f2SbellardFILES= \ 79586314f2SbellardCOPYING.LIB dyngen.c ioctls.h ops_template.h syscall_types.h\ 80586314f2SbellardMakefile elf.h linux_bin.h segment.h thunk.c\ 81586314f2SbellardTODO elfload.c main.c signal.c thunk.h\ 82586314f2Sbellardcpu-i386.h gemu.h op-i386.c syscall-i386.h translate-i386.c\ 83586314f2Sbellarddis-asm.h gen-i386.h op-i386.h syscall.c\ 84586314f2Sbellarddis-buf.c i386-dis.c opreg_template.h syscall_defs.h\ 85586314f2Sbellardi386.ld ppc.ld\ 86*77f8dd5aSbellardtests/Makefile\ 87586314f2Sbellardtests/test-i386.c tests/test-i386-shift.h tests/test-i386.h\ 88d57c4e01Sbellardtests/test-i386-muldiv.h\ 89586314f2Sbellardtests/test2.c tests/hello.c tests/sha1.c tests/test1.c 90586314f2Sbellard 91586314f2SbellardFILE=gemu-$(VERSION) 92586314f2Sbellard 93586314f2Sbellardtar: 94586314f2Sbellard rm -rf /tmp/$(FILE) 95586314f2Sbellard mkdir -p /tmp/$(FILE) 96586314f2Sbellard cp -P $(FILES) /tmp/$(FILE) 97586314f2Sbellard ( cd /tmp ; tar zcvf ~/$(FILE).tar.gz $(FILE) ) 98586314f2Sbellard rm -rf /tmp/$(FILE) 99586314f2Sbellard 10031e31b8aSbellardifneq ($(wildcard .depend),) 10131e31b8aSbellardinclude .depend 10231e31b8aSbellardendif 103