AcessNative - Bugfixes 'r' us, GUI can start and render (partially)
[tpg/acess2.git] / AcessNative / ld-acess_src / Makefile
index bbce43d..805b3a5 100644 (file)
@@ -14,10 +14,15 @@ ifeq ($(PLATFORM),win)
 endif
 ifeq ($(PLATFORM),lin)
        BIN := ../ld-acess
-       LD += -m elf_i386
+       LINKADDR := 0x70000000
+#      LD += -m elf_i386
 endif
 
-CFLAGS += -Wall -Werror -g -m32
+CFLAGS   += -Wall
+CFLAGS   += -Werror
+CFLAGS   += -g
+CPPFLAGS += -DARCHDIR_is_x86_64=1
+LDFLAGS  += -g -Wl,-T,obj-$(PLATFORM)/link.ld
 
 DEPFILES  = $(filter %.o,$(OBJ))
 DEPFILES := $(DEPFILES:%=%.dep)
@@ -27,10 +32,11 @@ DEPFILES := $(DEPFILES:%=%.dep)
 all: $(BIN)
 
 clean:
-       $(RM) $(BIN) $(OBJ) $(DEPFILES)
+       $(RM) $(BIN) $(OBJ) $(DEPFILES) obj-$(PLATFORM)/link.ld
 
 $(BIN): obj-$(PLATFORM)/link.ld $(OBJ)
-       $(CC) -g -o $@ $(OBJ) -m32 -Wl,-T,obj-$(PLATFORM)/link.ld
+       $(CC) $(LDFLAGS) -o $@ $(OBJ)
+       objdump -S $@ > [email protected]
 
 obj-$(PLATFORM)/%.o: %.c
        @mkdir -p $(dir $@)
@@ -39,10 +45,10 @@ obj-$(PLATFORM)/%.o: %.c
        @$(CC) -M $(CPPFLAGS) -MT $@ -o [email protected] $<
 
 # Modify the default makefile to put the executable at 1MB instead
-obj-lin/link.ld:
+obj-lin/link.ld: Makefile
        @mkdir -p $(dir $@)
        @echo "Making Linker Script ($@)"
-       @$(LD) --verbose | awk '{ if( substr($$0,0,5) == "====="){ bPrint = !bPrint; } else { if(bPrint){ print $$0;} } }' | sed 's/\b0x0[08][0-9]*\b/0x00100000/g' > $@
+       $(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' > $@
 
 -include $(DEPFILES)
 

UCC git Repository :: git.ucc.asn.au