From: John Hodge Date: Thu, 24 Mar 2011 02:31:13 +0000 (+0800) Subject: Usermode - Changed build system to separate different arch builds X-Git-Tag: rel0.10~143 X-Git-Url: https://git.ucc.asn.au/?p=tpg%2Facess2.git;a=commitdiff_plain;h=954abc650a400e5d8798ed3565a02645a9eeec55 Usermode - Changed build system to separate different arch builds - Now all object files are put in a directory for each architecture > e.g. 'obj-i386/main.o' - Fixed a compile error in telnet --- diff --git a/Usermode/Applications/Makefile.tpl b/Usermode/Applications/Makefile.tpl index 9dc97870..f16ae112 100644 --- a/Usermode/Applications/Makefile.tpl +++ b/Usermode/Applications/Makefile.tpl @@ -6,9 +6,12 @@ CFLAGS += -Wall -Werror -fno-builtin -fno-stack-protector -g LDFLAGS += -DEPFILES := $(OBJ:%.o=%.d) - _BIN := $(OUTPUTDIR)$(DIR)/$(BIN) +_OBJPREFIX := obj-$(ARCH)/ + +OBJ := $(addprefix $(_OBJPREFIX),$(OBJ)) + +DEPFILES := $(OBJ:%.o=%.dep) .PHONY : all clean install @@ -31,9 +34,12 @@ else endif @objdump -d -S $(_BIN) > $(BIN).dsm -$(OBJ): %.o: %.c +$(OBJ): $(_OBJPREFIX)%.o: %.c @echo --- GCC -o $@ +ifneq ($(_OBJPREFIX),) + @mkdir -p $(_OBJPREFIX) +endif @$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ - @$(CC) -M -MT $@ $(CPPFLAGS) $< -o $*.d + @$(CC) -M -MT $@ $(CPPFLAGS) $< -o $(_OBJPREFIX)$*.dep -include $(DEPFILES) diff --git a/Usermode/Applications/telnet_src/main.c b/Usermode/Applications/telnet_src/main.c index 519978db..d1f8d175 100644 --- a/Usermode/Applications/telnet_src/main.c +++ b/Usermode/Applications/telnet_src/main.c @@ -100,7 +100,6 @@ int main(int argc, char *argv[], char *envp[]) int OpenTCP(const char *AddressString, short PortNumber) { int fd, addrType; - char *iface; uint8_t addrBuffer[16]; // Parse IP Address diff --git a/Usermode/Libraries/Makefile.cfg b/Usermode/Libraries/Makefile.cfg index 9b1dd91f..430d98dc 100644 --- a/Usermode/Libraries/Makefile.cfg +++ b/Usermode/Libraries/Makefile.cfg @@ -5,7 +5,7 @@ MAKEDEP = $(CC) -M -ASFLAGS := -felf -CPPFLAGS := -I$(ACESSDIR)/Usermode/include/ +ASFLAGS := -felf -D ARCHDIR=$(ARCHDIR) +CPPFLAGS := -I$(ACESSDIR)/Usermode/include/ -D ARCHDIR=$(ARCHDIR) -D ARCHDIR_IS_$(ARCHDIR)=1 CFLAGS := -g -Wall -fPIC -fno-builtin -fno-stack-protector $(CPPFLAGS) LDFLAGS := -g -nostdlib -shared -I/Acess/Libs/ld-acess.so -e SoMain -x -L$(OUTPUTDIR)Libs/ diff --git a/Usermode/Libraries/Makefile.tpl b/Usermode/Libraries/Makefile.tpl index ccae9cac..e7dd73c5 100644 --- a/Usermode/Libraries/Makefile.tpl +++ b/Usermode/Libraries/Makefile.tpl @@ -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 @@ -24,14 +28,16 @@ $(_BIN): $(OBJ) @$(LD) $(LDFLAGS) -o $(_BIN) $(OBJ) @$(OBJDUMP) -d -S $(_BIN) > $(_BIN).dsm -%.o: %.c +$(_OBJPREFIX)%.o: %.c @echo [CC] -o $@ + @mkdir -p $(dir $@) @$(CC) $(CFLAGS) -o $@ -c $< - @$(CC) -M -MT $@ $(CPPFLAGS) $< -o $@.d + @$(CC) -M -MT $@ $(CPPFLAGS) $< -o $@.dep -%.ao: %.asm +$(_OBJPREFIX)%.ao: %.asm @echo [AS] -o $@ + @mkdir -p $(dir $@) @$(AS) $(ASFLAGS) -o $@ $< - @$(AS) $(ASFLAGS) -o $@ $< -M > $@.d + @$(AS) $(ASFLAGS) -o $@ $< -M > $@.dep -include $(DEPFILES)