SpiderScript - Fixing order of operations, improved error handling and cleanup
[tpg/acess2.git] / Usermode / Libraries / Makefile.tpl
index ccae9ca..1bb96a2 100644 (file)
@@ -2,10 +2,14 @@
 # - Library Common Makefile
 #
 
-DEPFILES := $(addsuffix .d,$(OBJ))
 
 _BIN := $(OUTPUTDIR)Libs/$(BIN)
 _XBIN := $(addprefix $(OUTPUTDIR)Libs/,$(EXTRABIN))
+_OBJPREFIX := obj-$(ARCH)/
+
+OBJ := $(addprefix $(_OBJPREFIX),$(OBJ))
+
+DEPFILES := $(addsuffix .dep,$(OBJ))
 
 .PHONY: all clean install postbuild
 
@@ -22,16 +26,18 @@ $(_BIN): $(OBJ)
        @mkdir -p $(dir $(_BIN))
        @echo [LD] -o $(BIN) $(OBJ)
        @$(LD) $(LDFLAGS) -o $(_BIN) $(OBJ)
-       @$(OBJDUMP) -d -S $(_BIN) > $(_BIN).dsm
+       @$(DISASM) $(_BIN) > $(_BIN).dsm
 
-%.o: %.c
+$(_OBJPREFIX)%.o: %.c
        @echo [CC] -o $@
+       @mkdir -p $(dir $@)
        @$(CC) $(CFLAGS) -o $@ -c $<
-       @$(CC) -M -MT $@ $(CPPFLAGS) $< -o [email protected]
+       @$(CC) -M -MT $@ $(CPPFLAGS) $< -o [email protected]ep
 
-%.ao: %.asm
+$(_OBJPREFIX)%.ao: %.asm
        @echo [AS] -o $@
+       @mkdir -p $(dir $@)
        @$(AS) $(ASFLAGS) -o $@ $<
-       @$(AS) $(ASFLAGS) -o $@ $< -M > [email protected]
+       @$(AS) $(ASFLAGS) -o $@ $< -M > [email protected]ep
 
 -include $(DEPFILES)

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