3 # DROPS (Dresden Realtime OPerating System) Component
5 # Makefile-Template for idl directories
7 # install.inc is used, see there for further documentation
8 # - from install.inc, we use the feature to install files
9 # to the local install directory on 'all' target.
10 # Therefore, we set INSTALLDIR_LOCAL and INSTALLFILE_LOCAL.
11 # Note that we changed INSTALLDIR_IDL_LOCAL AND INSTALLDIR_IDL
12 # binary.inc is used, see there for further documentation
14 ifeq ($(origin _L4DIR_MK_IDL_MK),undefined)
19 DICE_REQ := --require="3.2.0"
21 # define LOCAL_INSTALLDIR prior to including install.inc, where the install-
22 # rules are defined. Same for INSTALLDIR.
23 INSTALLDIR_IDL ?= $(DROPS_STDDIR)/include/$(ARCH)/$(L4API)/$(INSTALL_INC_PREFIX)
24 INSTALLDIR_IDL_LOCAL ?= $(OBJ_BASE)/include/$(ARCH)/$(L4API)/$(INSTALL_INC_PREFIX)
25 INSTALLFILE_IDL ?= $(INSTALL) -m 644 $(1) $(2)
26 INSTALLFILE_IDL_LOCAL ?= $(LN) -sf $(call absfilename,$(1)) $(2)
28 INSTALLFILE = $(INSTALLFILE_IDL)
29 INSTALLDIR = $(INSTALLDIR_IDL)
30 INSTALLFILE_LOCAL = $(INSTALLFILE_IDL_LOCAL)
31 INSTALLDIR_LOCAL = $(INSTALLDIR_IDL_LOCAL)
33 INSTALL_INC_PREFIX ?= l4/$(PKGNAME)
35 # our default MODE is 'static'
41 include $(L4DIR)/mk/Makeconf
42 include $(L4DIR)/mk/binary.inc
43 $(GENERAL_D_LOC): $(L4DIR)/mk/idl.mk
45 ifneq ($(SYSTEM),) # if we have a system, really build
46 #######################################################
48 # SYSTEM valid, we are in an OBJ-<xxx> system subdir
50 #######################################################
59 ifneq (,$(findstring BmCPP,$(IDL_FLAGS)))
64 ifneq (,$(findstring Bmcpp,$(IDL_FLAGS)))
71 IDL_DEP = $(addprefix .,$(addsuffix .d,$(notdir $(IDL))))
72 IDL_SKELETON_C = $(IDL:.idl=-server.$(IDL_C))
73 IDL_SKELETON_H = $(IDL_SKELETON_C:.$(IDL_C)=.$(IDL_H))
74 IDL_STUB_C = $(IDL:.idl=-client.$(IDL_C))
75 IDL_STUB_H = $(IDL_STUB_C:.$(IDL_C)=.$(IDL_H))
76 IDL_OPCODE_H = $(IDL:.idl=-sys.$(IDL_H))
78 IDL_FILES = $(IDL_SKELETON_C) $(IDL_SKELETON_H) $(IDL_STUB_C) $(IDL_STUB_H) \
81 # Makro that expands to the list of generated files
82 # arg1 - name of the idl file. Path and extension will be stripped
83 IDL_FILES_EXPAND = $(addprefix $(notdir $(basename $(1))),-server.$(IDL_C) -server.$(IDL_H) -client.$(IDL_C) -client.$(IDL_H) -sys.$(IDL_H))
85 INSTALL_TARGET = $(patsubst %.idl,%-sys.$(IDL_H), \
86 $(filter $(IDL_EXPORT_SKELETON) $(IDL_EXPORT_STUB),$(IDL)))\
87 $(patsubst %.idl,%-server.$(IDL_H), \
88 $(filter $(IDL_EXPORT_SKELETON),$(IDL))) \
89 $(patsubst %.idl,%-client.$(IDL_H), \
90 $(filter $(IDL_EXPORT_STUB), $(IDL)))
95 # the dependencies for the generated files
98 ifneq (,$(filter-out corba dice, $(IDL_TYPE)))
99 $(error IDL_TYPE is neither <dice> nor <corba>)
102 # the IDL file is found one directory up
103 vpath %.idl $(SRC_DIR)
106 IDL_FLAGS += $(addprefix -P,$(CPPFLAGS))
107 IDL_FLAGS += $(IDL_FLAGS_$(<F))
110 IDL_FLAGS += -Bifiasco
121 ifeq ($(L4API),linux)
125 ifeq ($(L4API),l4secv2emu)
126 IDL_FLAGS += -fforce-c-bindings -P-DL4API_l4f
138 IDL_FLAGS += -Bpamd64
141 ifeq ($(IDL_TYPE),corba)
142 IDL_FLAGS += --x=corba
145 # We don't use gendep for generating the dependencies because gendep can only
146 # catch open() calls from _one_ applications. Here two applications, dice and
147 # the preprocessor perform open.
148 %-server.$(IDL_C) %-server.$(IDL_H) %-client.$(IDL_C) %-client.$(IDL_H) %-sys.$(IDL_H): %.idl .general.d
150 $(VERBOSE)CC="$(IDL_CPP)" $(DICE) $(DICE_REQ) $(IDL_FLAGS) -MD $<
151 $(VERBOSE)mv $*.d .$(<F).d
152 $(DEPEND_VERBOSE)$(ECHO) "$(call IDL_FILES_EXPAND,$<): $(DICE) $<" >>.$(<F).d
153 $(DEPEND_VERBOSE)$(ECHO) "$(DICE) $<:" >>.$(<F).d
157 $(VERBOSE)$(RM) $(wildcard $(addprefix $(INSTALLDIR_LOCAL)/, $(IDL_FILES)))
158 $(VERBOSE)$(RM) $(wildcard $(IDL_FILES))
160 # include install.inc to define install rules
161 include $(L4DIR)/mk/install.inc
164 #####################################################
166 # No SYSTEM defined, we are in the idl directory
168 #####################################################
170 # we install the IDL-files specified in IDL_EXPORT_IDL
171 INSTALL_TARGET = $(filter $(IDL_EXPORT_IDL), $(IDL))
173 # include install.inc to define install rules
174 include $(L4DIR)/mk/install.inc
176 # install idl-files before going down to subdirs
177 $(foreach arch,$(TARGET_SYSTEMS), $(OBJ_DIR)/OBJ-$(arch)): $(addprefix $(INSTALLDIR_LOCAL)/,$(INSTALL_TARGET))
179 endif # architecture is defined, really build
180 #####################################################
184 #####################################################
187 .PHONY: all clean cleanall config help install oldconfig txtconfig
190 @echo " all - generate .c and .h from idl files and install locally"
192 @echo " to $(INSTALLDIR_LOCAL)"
194 @echo " scrub - delete backup and temporary files"
195 @echo " clean - delete generated source files"
196 @echo " cleanall - delete all generated, backup and temporary files"
197 @echo " help - this help"
199 @echo " idls are: $(IDL)"
202 endif # _L4DIR_MK_IDL_MK undefined