3 # - Application Template Makefile
6 CFLAGS += -Wall -Werror -fno-builtin -fno-stack-protector -g
9 _BIN := $(OUTPUTDIR)$(DIR)/$(BIN)
10 _OBJPREFIX := obj-$(ARCH)/
12 _LIBS := $(filter -l%,$(LDFLAGS))
13 _LIBS := $(patsubst -l%,$(OUTPUTDIR)Libs/lib%.so,$(_LIBS))
15 OBJ := $(addprefix $(_OBJPREFIX),$(OBJ))
17 DEPFILES := $(OBJ:%.o=%.dep)
19 .PHONY : all clean install
24 @$(RM) $(OBJ) $(DEPFILES) $(_BIN) $(BIN).dsm
25 @$(RM) -r $(_OBJPREFIX)
28 @echo [xCP] $(DISTROOT)/$(DIR)/$(BIN)
29 @$(xMKDIR) $(DISTROOT)/$(DIR); true
30 @$(STRIP) $(_BIN) -o $(_BIN)_
31 @$(xCP) $(_BIN)_ $(DISTROOT)/$(DIR)/$(BIN)
34 $(_BIN): $(OUTPUTDIR)Libs/acess.ld $(OUTPUTDIR)Libs/crt0.o $(_LIBS) $(OBJ)
35 @mkdir -p $(dir $(_BIN))
37 ifneq ($(_DBGMAKEFILE),)
38 $(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map $(_OBJPREFIX)Map.txt
40 @$(LD) -g $(LDFLAGS) -o $@ $(OBJ) -Map $(_OBJPREFIX)Map.txt
42 @$(DISASM) $(_BIN) > $(_OBJPREFIX)$(BIN).dsm
44 $(OBJ): $(_OBJPREFIX)%.o: %.c
46 ifneq ($(_OBJPREFIX),)
49 @$(CC) $(CFLAGS) $(CPPFLAGS) -c $< -o $@
50 @$(CC) -M -MT $@ $(CPPFLAGS) $< -o $(_OBJPREFIX)$*.dep
52 $(OUTPUTDIR)Libs/libld-acess.so:
53 @make -C $(ACESSDIR)/Usermode/Libraries/ld-acess.so_src/
55 @make -C $(ACESSDIR)/Usermode/Libraries/$*_src/