Fix LUA red and yellow.
[kugel-rb.git] / tools / make.inc
blob5521612f6299d063a1031a4d274942bac5e46e50
1 # -*- Makefile -*-
3 ifndef V
4 SILENT=@
5 endif
6 PRINTS=$(SILENT)$(call info,$(1))
8 $(OBJDIR)/%.o: %.c
9         $(SILENT)mkdir -p $(dir $@)
10         $(call PRINTS,CC $<)$(CC) $(CFLAGS) -c $< -o $@
12 $(OBJDIR)/%.o: %.S
13         $(SILENT)mkdir -p $(dir $@)
14         $(call PRINTS,CC $<)$(CC) $(CFLAGS) -c $< -o $@
16 # The echo stuff last in the dep update shell magic is to prevent any compiler
17 # errors/warnings to cause an error code to get returned and thus stop the
18 # build
20 # This script checks for the presence of $(BUILDDIR)/lang/lang.h and if it doesn't
21 # alreay exist, it is created. This is because lots of files include this
22 # *generated* file and if it doesn't exist when we generate the deps it is no
23 # good. There's a -MG compiler option to cover for this case, but it doesn't
24 # play nicely into this as it then adds a dependency to the lang.h file
25 # without the proper path.
27 # The trailing sed hack for a range of files is present because how gcc works
28 # for generating dependencies when the include file doesn't exist. Then it
29 # makes the dependency without any path, and that breaks how things work for
30 # us. We thus add the correct path for a few generated files!
32 $(DEPFILE): $(SOURCES)
33         $(SILENT)mkdir -p $(dir $(DEPFILE))
34         $(SILENT)rm -f $(DEPFILE)
35         $(SILENT)(for each in $(SOURCES) x; do \
36             if test "$$each" = "credits.c"; then \
37                 del="$$del$(BUILDDIR)/credits.raw"; \
38                 touch $(BUILDDIR)/credits.raw; \
39             fi; \
40             if test "x" != "$$each"; then \
41                 obj=`echo $$each | sed -e 's/\.[cS]/.o/'`; \
42                 $(CC) -MG -MM -MT "$(OBJDIR)/$$obj" $(CFLAGS) $$each 2>/dev/null; \
43             fi; \
44             if test -n "$$del"; then \
45                 rm $$del; \
46                 del=""; \
47             fi \
48         done | sed -e "s:[^[:space:]]*lang.h:$(OBJDIR)/lang/lang.h:" \
49         -e "s:[^[:space:]]*sysfont.h:$(BUILDDIR)/sysfont.h:" \
50         -e "s:[^[:space:]]*max_language_size.h:$(BUILDDIR)/max_language_size.h:" \
51         -e "s: bitmaps/: $(BUILDDIR)/bitmaps/:g" \
52         -e "s: pluginbitmaps/: $(BUILDDIR)/pluginbitmaps/:g" \
53         > $(DEPFILE); \
54         echo "oo" > /dev/null )
56 tags:
57         $(SILENT)(for d in $(DIRS); do \
58             etags -o $(OBJDIR)/TAGS -a $$d/*.[ch]; \
59         done)