8 OBJ := main.o syscalls.o request.o binary.o memory.o exports.o
9 OBJ += elf.o elf_load.o
10 OBJ := $(addprefix obj-$(PLATFORM)/,$(OBJ))
12 ifeq ($(PLATFORM),win)
13 BIN := ../ld-acess.exe
14 LINKADDR := 0x70000000
15 LDFLAGS += -lws2_32 -Wl,--image-base,$(LINKADDR)
17 ifeq ($(PLATFORM),lin)
19 LINKADDR := 0x70000000
26 CPPFLAGS += -DARCHDIR_is_x86_64=1
27 LDFLAGS += -g -Wl,-T,obj-$(PLATFORM)/link.ld
29 DEPFILES = $(filter %.o,$(OBJ))
30 DEPFILES := $(DEPFILES:%=%.dep)
37 $(RM) $(BIN) $(OBJ) $(DEPFILES) obj-$(PLATFORM)/link.ld
39 $(BIN): obj-$(PLATFORM)/link.ld $(OBJ)
40 $(CC) -o $@ $(OBJ) $(LDFLAGS)
43 obj-$(PLATFORM)/%.o: %.c
46 @$(CC) -c $< -o $@ $(CFLAGS) $(CPPFLAGS)
49 # Modify the default makefile to put the executable at 1MB instead
50 obj-lin/link.ld: Makefile
52 @echo "Making Linker Script ($@)"
53 $(LD) -g --verbose | awk '{ if( substr($$1,0,5) == "====="){ bPrint = !bPrint; } else { if(bPrint){ print $$0;} } }' | sed 's/\b0x[048][0-9]*\b/$(LINKADDR)/g' | sed 's/CONSTANT (MAXPAGESIZE)/0x1000/g' > $@
55 # Modify the default makefile to put the executable at 1MB instead
56 obj-win/link.ld: Makefile
58 @echo "Making Linker Script ($@)"
59 $(LD) -g --verbose | awk '{ if( substr($$1,0,5) == "====="){ bPrint = !bPrint; } else { if(bPrint){ print $$0;} } }' | sed 's/\b0x[048][0-9]*\b/$(LINKADDR)/g' | sed 's/CONSTANT (MAXPAGESIZE)/0x1000/g' > $@