X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2FMakefile.tpl;h=a6c8508c4ce379df754d7e9569deb4b04ca230e8;hb=433fc48ffc7f0fc337a704e4f2f4f4390de60f70;hp=27cf9e54d00294fc0a53a717e4250066ad188efe;hpb=a644ed9dc9954091daf616dfe93ab2e2a920bf5d;p=tpg%2Facess2.git diff --git a/Usermode/Applications/Makefile.tpl b/Usermode/Applications/Makefile.tpl index 27cf9e54..a6c8508c 100644 --- a/Usermode/Applications/Makefile.tpl +++ b/Usermode/Applications/Makefile.tpl @@ -3,15 +3,29 @@ # - Application Template Makefile # -CFLAGS += -Wall -Werror -fno-builtin -fno-stack-protector -g +CFLAGS += -g LDFLAGS += -g +LDFLAGS += -Map $(_OBJPREFIX)Map.txt + +ifneq ($(lastword $(subst -, ,$(basename $(LD)))),ld) + comma=, + LDFLAGS := $(subst -rpath-link ,-Wl$(comma)-rpath-link$(comma),$(LDFLAGS)) + LDFLAGS := $(subst -Map ,-Wl$(comma)-Map$(comma),$(LDFLAGS)) +endif + _BIN := $(OUTPUTDIR)$(DIR)/$(BIN) _OBJPREFIX := obj-$(ARCH)/ _LIBS := $(filter -l%,$(LDFLAGS)) _LIBS := $(patsubst -l%,$(OUTPUTDIR)Libs/lib%.so,$(_LIBS)) +ifeq ($(VERBOSE),) +V := @ +else +V := +endif + OBJ := $(addprefix $(_OBJPREFIX),$(OBJ)) DEPFILES := $(OBJ:%.o=%.dep) @@ -34,20 +48,23 @@ install: $(_BIN) $(_BIN): $(OUTPUTDIR)Libs/acess.ld $(OUTPUTDIR)Libs/crt0.o $(_LIBS) $(OBJ) @mkdir -p $(dir $(_BIN)) @echo [LD] -o $@ -ifneq ($(_DBGMAKEFILE),) - $(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map $(_OBJPREFIX)Map.txt -else - @$(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map $(_OBJPREFIX)Map.txt -endif - @$(DISASM) $(_BIN) > $(_OBJPREFIX)$(BIN).dsm + $V$(LD) -g $(LDFLAGS) -o $@ $(CRTBEGIN) $(OBJ) $(LIBGCC_PATH) $(CRTEND) + $V$(DISASM) $(_BIN) > $(_OBJPREFIX)$(BIN).dsm -$(OBJ): $(_OBJPREFIX)%.o: %.c +$(_OBJPREFIX)%.o: %.c @echo [CC] -o $@ ifneq ($(_OBJPREFIX),) @mkdir -p $(dir $@) endif - @$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ - @$(CC) -M -MT $@ $(CPPFLAGS) $< -o $(_OBJPREFIX)$*.dep + $V$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@ + $V$(CC) -M -MP -MT $@ $(CPPFLAGS) $< -o $(_OBJPREFIX)$*.dep + +$(_OBJPREFIX)%.o: %.cpp + @echo [CXX] -o $@ +ifneq ($(_OBJPREFIX),) + @mkdir -p $(dir $@) +endif + $V$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ -MQ $@ -MP -MD -MF $(_OBJPREFIX)$*.dep $(OUTPUTDIR)Libs/libld-acess.so: @make -C $(ACESSDIR)/Usermode/Libraries/ld-acess.so_src/ @@ -55,3 +72,5 @@ $(OUTPUTDIR)Libs/%: @make -C $(ACESSDIR)/Usermode/Libraries/$*_src/ -include $(DEPFILES) + +# vim: ft=make