1 # NOTE: due to suckage of make that I can't figure out how to work
2 # around, you'll have to run make twice after you update a .cdl file
3 # in order to make sure that any code that includes the generated
4 # headers has been rebuilt. This is despite having an explicit
5 # dependency of the .cc file on the normal .h, of the normal .h on
6 # the generated .h, of the generated headers on the server directory,
7 # and of the server directory on the CDL file. The CDL->directory rule
8 # is used to generated the headers, but even if it's done specifically
9 # for the .cc file up the chain, it doesn't rebuild the .cc file.
11 include ../../Makefile.target
14 INCS := -Iinclude -I../include/c++ -I../include/generated/c++ \
19 CXXFLAGS += $(INCS) $(DEFS) -Wall -Werror -O3 -g3 -fno-rtti \
20 -fno-exceptions -fno-builtin
24 .PHONY: symlinks all default rerun dep servers clean distclean
30 ln -sfn arch-$(ARCH) include/arch
32 # Make sure "make" treats thse as the right type of variable
33 # when += is used later.
37 # Must come first: contains boot entry code
38 include arch/$(ARCH)/Makefile
45 # Must come last: contains kernel target
46 include arch/$(ARCH)/Makefile.final
49 rm -rf $(foreach dir,$(DIRS),$(dir)*.o $(dir)*-server)
50 rm -f kernel kernel.stripped
53 rm -f .depend .gdb_history include/arch
55 # Every .o file which has a corresponding .cdl file will
56 # depend on the server stubs.
58 SERVERS := $(foreach obj,$(OBJS),$(wildcard $(obj:.o=).cdl))
59 SERVERS := $(SERVERS:%.cdl=%)
61 $(SERVERS:%=%-server): %-server: %.cdl $(TOP)/../ifaces
62 rm -rf "$(BUILDDIR)/$@"
63 $(IDLC) -t $(ARCH) -l c++ -r -i "$(TOP)/../ifaces" -o "$(BUILDDIR)/$@" "$<"
65 $(SERVERS:%=%.cc): %.cc: %-server
67 servers: symlinks $(SERVERS:%=%-server)
71 for i in $(OBJS:.o=); do \
73 if [ -e "$$i".$$j ]; then \
78 if [ "$$FILE" ]; then \
79 $(CXX) $(CXXFLAGS) -M -MT "$$i".o "$$FILE" >> .depend; \
82 for i in $(SERVERS); do \
83 $(IDLC) -M -l c++ -r -i "$(TOP)/../ifaces" -o "$$i-server" "$$i.cdl" >> .depend; \
86 ifeq (.depend,$(wildcard .depend))
88 default: kernel kernel.stripped