Usermode/ld-acess - Overhaul cleanup of ELF loader
[tpg/acess2.git] / Usermode / Libraries / ld-acess.so_src / Makefile
index 64a120c..78aac4b 100644 (file)
@@ -5,31 +5,53 @@
 -include ../Makefile.cfg
 
 OBJ := main.o lib.o loadlib.o export.o elf.o pe.o
-OBJ += arch/$(ARCHDIR).ao
+OBJ += arch/$(ARCHDIR).ao_
 BIN = ld-acess.so
 EXTRABIN := libld-acess.so
+EXTRACLEAN = $(_OBJPREFIX)_stublib.o
+INCFILES := sys/sys.h
 
-CFLAGS   = -Wall -fno-builtin -fno-leading-underscore -fno-stack-protector
+#CPPFLAGS += -D DISABLE_ELF64
+CFLAGS   = -g -Wall -fno-builtin -fno-stack-protector -fPIC -std=c99 -ffreestanding
+# -fno-leading-underscore
 CFLAGS  += $(CPPFLAGS)
-ASFLAGS  = -felf
-LDFLAGS  = -T link.ld -Map map.txt --export-dynamic
+LDFLAGS  = -ffreestanding -nostdlib -g -Wl,-T,arch/$(ARCHDIR).ld -Map map.txt --export-dynamic -x
+LIBS := $(LIBGCC_PATH)
+
+ifeq ($(ARCH),native)
+XBIN := $(addprefix $(OUTPUTDIR)Libs/,$(EXTRABIN)) 
+$(XBIN): obj-$(ARCH)/_stublib.o
+all: $(XBIN)
+CFLAGS += -ffreestanding
+LDFLAGS := 
+BIN := 
+OBJ :=
+endif
 
 include ../Makefile.tpl
 
 # create libld-acess.so
-$(_XBIN): $(_BIN)
+$(_XBIN): $(_OBJPREFIX)_stublib.o
        @echo [LD] -o -shared libld-acess.so
-       @$(LD) $(LDFLAGS) -shared -o $@ $(OBJ)
+       $(LD) -shared -o $@ $<
+#      @$(LD) $(LDFLAGS) -o $@ $(OBJ)
+
 
 # Override .ao to look in the object prefix for the source
-%.ao: %.asm
+$(_OBJPREFIX)arch/$(ARCHDIR).ao_: $(_OBJPREFIX)arch/$(ARCHDIR).$(ASSUFFIX)
        @echo [AS] -o $@
        @mkdir -p $(dir $@)
        @$(AS) $(ASFLAGS) -o $@ $<
 
+#.PRECIOUS: $(OBJ:%.ao=%.asm)
+
 # Preprocessing objects if needed
-$(_OBJPREFIX)%: %.h
+$(_OBJPREFIX)arch/$(ARCHDIR).$(ASSUFFIX): arch/$(ARCHDIR).$(ASSUFFIX).h arch/syscalls.s.h
        @echo [CPP] -o $@
        @mkdir -p $(dir $@)
-       @$(CPP) $(CPPFLAGS) -P -D_ASM_ $< -o $@
+       @$(CPP) $(CPPFLAGS) -P -D__ASSEMBLER__ $< -o $@
+
+$(_OBJPREFIX)arch/$(ARCHDIR).$(ASSUFFIX): $(ACESSDIR)/KernelLand/Kernel/include/syscalls.h
+
+$(_OBJPREFIX)_stublib.o: arch/syscalls.s.h
 

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