3 # - Application Template Makefile
9 LDFLAGS += -Map $(_OBJPREFIX)Map.txt
11 ifneq ($(lastword $(subst -, ,$(basename $(LD)))),ld)
13 LDFLAGS := $(subst -rpath-link ,-Wl$(comma)-rpath-link$(comma),$(LDFLAGS))
14 LDFLAGS := $(subst -Map ,-Wl$(comma)-Map$(comma),$(LDFLAGS))
17 _BIN := $(OUTPUTDIR)$(DIR)/$(BIN)
18 _OBJPREFIX := obj-$(ARCH)/
20 _LIBS := $(filter -l%,$(LDFLAGS))
21 _LIBS := $(patsubst -l%,$(OUTPUTDIR)Libs/lib%.so,$(_LIBS))
29 OBJ := $(addprefix $(_OBJPREFIX),$(OBJ))
31 DEPFILES := $(OBJ:%.o=%.dep)
33 .PHONY : all clean install
38 @$(RM) $(OBJ) $(DEPFILES) $(_BIN) $(BIN).dsm
39 @$(RM) -r $(_OBJPREFIX)
42 @echo [xCP] $(DISTROOT)/$(DIR)/$(BIN)
43 @$(xMKDIR) $(DISTROOT)/$(DIR); true
44 @$(STRIP) $(_BIN) -o $(_BIN)_
45 @$(xCP) $(_BIN)_ $(DISTROOT)/$(DIR)/$(BIN)
48 $(_BIN): $(OUTPUTDIR)Libs/acess.ld $(OUTPUTDIR)Libs/crt0.o $(_LIBS) $(OBJ)
49 @mkdir -p $(dir $(_BIN))
51 $V$(LD) -g $(LDFLAGS) -o $@ $(CRTBEGIN) $(OBJ) $(LIBGCC_PATH) $(CRTEND)
52 $V$(DISASM) $(_BIN) > $(_OBJPREFIX)$(BIN).dsm
56 ifneq ($(_OBJPREFIX),)
59 $V$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
60 $V$(CC) -M -MP -MT $@ $(CPPFLAGS) $< -o $(_OBJPREFIX)$*.dep
62 $(_OBJPREFIX)%.o: %.cpp
64 ifneq ($(_OBJPREFIX),)
67 $V$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $< -o $@ -MQ $@ -MP -MD -MF $(_OBJPREFIX)$*.dep
69 $(OUTPUTDIR)Libs/libld-acess.so:
70 @make -C $(ACESSDIR)/Usermode/Libraries/ld-acess.so_src/
72 @make -C $(ACESSDIR)/Usermode/Libraries/$*_src/