am_sysinfo: Create and remove Debug and Release directory
[apps/am_sysinfo.git] / mem_util / makefile
index f0a0ae1026b13f24222d3f96679d8cc7aa9bc62e..48bdd38b8a688f3e24402c0410368e1650ded889 100644 (file)
@@ -16,7 +16,7 @@
 #   ----------------------------------------------------------------------------
 #   Included defined variables
 #   ----------------------------------------------------------------------------
-include ../../../Rules.make
+-include ../../../Rules.make
 
 #   ----------------------------------------------------------------------------
 #   Variables passed in externally
@@ -56,6 +56,7 @@ OBJDIR_R := Release
 BINDIR_R := $(OBJDIR_R)
 LIBS_R := $(LIBS)
 OBJS_R := $(SRCS:%.c=$(OBJDIR_R)/%.o)
+ALL_RELEASE :=
 
 #   ----------------------------------------------------------------------------
 #   Compiler include directories 
@@ -97,6 +98,7 @@ $(BINDIR_D)/$(BIN): $(OBJS_D)
        $(CC) -o $@ $(OBJS_D) $(LIBS_D) $(LDFLAGS)  -Wl,-Map,$(BINDIR_D)/$(NAME).map
 
 $(OBJDIR_D)/%.o : %.c $(HDRS)
+       @mkdir -p $(OBJDIR_D)
        $(CC) $(ALL_DEBUG) $(DEFS) $(ALL_CFLAGS) -o$@ $<
 
 #   ----------------------------------------------------------------------------
@@ -111,10 +113,11 @@ $(BINDIR_R)/$(BIN): $(OBJS_R)
 
 
 $(OBJDIR_R)/%.o : %.c $(HDRS)
-       $(CC) $(DEFS) $(ALL_CFLAGS) -o$@ $<
+       @mkdir -p $(OBJDIR_R)
+       $(CC) $(DEFS) $(ALL_RELEASE) $(ALL_CFLAGS) -o$@ $<
 
 .PHONY: clean
 clean:
-       @rm -f $(OBJDIR_D)/*
-       @rm -f $(OBJDIR_R)/*
+       @rm -rf $(OBJDIR_D)
+       @rm -rf $(OBJDIR_R)