mesa: simplify dependencies in mmakefiles
[AROS.git] / tools / toollib / Makefile
blob40b8590770035b4ba33ef2e8a7d4b0dce3e30183
1 # Copyright © 1995-2001, The AROS Development Team. All rights reserved.
2 # $Id$
4 # Desc: Make the tool library.
6 SRC = error filesup hash lineparser mystream \
7 stdiocb stringcb toollib vstring
9 # Include the AROS build information. This will fail if $(TOP) is not
10 # set, and build in the current directory.
11 -include $(TOP)/config/make.cfg
13 # If the include above doesn't work, we need some defaults.
14 HOST_CC ?= $(CC)
15 HOST_AR ?= $(AR) cru
16 TOOLDIR ?= .
17 ifneq ($(HOSTGENDIR),)
18 OBJDIR := $(HOSTGENDIR)/$(CURDIR)
19 else
20 OBJDIR := $(TOOLDIR)/obj
21 endif
22 MKDIR ?= mkdir
23 MECHO ?= echo
24 TOOLLIB ?= $(TOOLDIR)/libtool.a
25 HOST_CFLAGS := $(HOST_CFLAGS) -Wall -g -DHAVE_VSNPRINTF -I.. -O
28 DEPS := $(foreach f,$(SRC),$(OBJDIR)/$(f).d)
30 all : depend $(OBJDIR) $(TOOLLIB)
32 $(TOOLLIB) : $(foreach f,$(SRC),$(OBJDIR)/$(f).o)
33 @$(MECHO) "Creating toollib/$(notdir $@)..."
34 @$(HOST_AR) $@ $?
36 $(OBJDIR)/%.o : %.c
37 @$(MECHO) "Compiling toollib/$(notdir $@)..."
38 @$(HOST_CC) $(HOST_CFLAGS) -o $@ -c $<
40 $(OBJDIR)/%.d : %.c
41 @$(MECHO) Finding dependencies for $<...
42 @$(MKDIR) -p $(dir $@)
43 @$(HOST_CC) $(HOST_CFLAGS) -M $< > $@
45 $(OBJDIR) :
46 @$(MKDIR) $(OBJDIR)
48 clean :
49 -@$(RM) -r $(OBJDIR) $(TOOLLIB)
50 @sed '/^# DO NOT DELETE$$/,$$d' Makefile > Makefile.tmp
51 @echo "# DO NOT DELETE" >> Makefile.tmp
52 @mv -f Makefile.tmp Makefile
53 -@$(RM) Makefile.bak
55 depend : $(DEPS)
57 -include $(DEPS)
58 # DO NOT DELETE