summaryrefslogtreecommitdiff
path: root/apps/examples/elf/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'apps/examples/elf/Makefile')
-rw-r--r--apps/examples/elf/Makefile36
1 files changed, 21 insertions, 15 deletions
diff --git a/apps/examples/elf/Makefile b/apps/examples/elf/Makefile
index 23a6bcb6f..ea483e7a1 100644
--- a/apps/examples/elf/Makefile
+++ b/apps/examples/elf/Makefile
@@ -39,29 +39,29 @@ include $(APPDIR)/Make.defs
# ELF Example
-ASRCS =
-CSRCS = elf_main.c
+ASRCS =
+CSRCS = elf_main.c symtab.c
-AOBJS = $(ASRCS:.S=$(OBJEXT))
-COBJS = $(CSRCS:.c=$(OBJEXT))
+AOBJS = $(ASRCS:.S=$(OBJEXT))
+COBJS = $(CSRCS:.c=$(OBJEXT))
-SRCS = $(ASRCS) $(CSRCS)
-OBJS = $(AOBJS) $(COBJS)
+SRCS = $(ASRCS) $(CSRCS)
+OBJS = $(AOBJS) $(COBJS)
ifeq ($(WINTOOL),y)
- BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
+ BIN = "${shell cygpath -w $(APPDIR)/libapps$(LIBEXT)}"
else
- BIN = "$(APPDIR)/libapps$(LIBEXT)"
+ BIN = "$(APPDIR)/libapps$(LIBEXT)"
endif
-ROOTDEPPATH = --dep-path .
+ROOTDEPPATH = --dep-path . --dep-path tests
-# Common build
+# Build targets
-VPATH =
+VPATH = tests
all: .built
-.PHONY: headers clean_tests clean depend disclean
+.PHONY: really_build clean_tests clean depend disclean
$(AOBJS): %$(OBJEXT): %.S
$(call ASSEMBLE, $<, $@)
@@ -69,15 +69,21 @@ $(AOBJS): %$(OBJEXT): %.S
$(COBJS): %$(OBJEXT): %.c
$(call COMPILE, $<, $@)
-headers:
- @$(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV)
+# This is a little messy. The build is broken into two pieces: (1) the
+# tests/ subdir build that auto-generates several files, and (2) the real
+# build. This is done because we need a fresh build context after auto-
+# generating the source files.
-.built: headers $(OBJS)
+really_build: $(OBJS)
@( for obj in $(OBJS) ; do \
$(call ARCHIVE, $(BIN), $${obj}); \
done ; )
@touch .built
+.built:
+ @$(MAKE) -C tests TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" CROSSDEV=$(CROSSDEV)
+ @$(MAKE) TOPDIR="$(TOPDIR)" APPDIR="$(APPDIR)" really_build
+
context:
# We can't make dependencies in this directory because the required