6 ifeq ($(PRELOAD_MODULES
),1)
7 MODULE_TARGETS
:= $(MODULE
).a
$(MODULE
).lc
9 MODULE_TARGETS
:= $(MODULE
).so
$(MODULE
).lc
11 TARGETS
:= $(TARGETS
) $(MODULE_TARGETS
)
15 LUA_COMPILED
:= $(subst .lua
,.lc
, $(LUA_SOURCES
))
16 TARGETS
:= $(TARGETS
) $(LUA_COMPILED
)
21 ######################################
25 .PHONY
: subdirs-realclean
26 .PHONY
: subdirs-depend
27 .PHONY
: subdirs-install
31 all: subdirs
$(TARGETS
)
33 clean: subdirs-clean _clean
35 realclean: subdirs-realclean _clean _realclean
37 depend
: subdirs-depend _depend
39 install: subdirs-install _install
43 ######################################
47 TO_CLEAN
:= $(TO_CLEAN
) exports.c
52 $(MKEXPORTS
) -module
$(MAKE_EXPORTS
) -o exports.c
$(SOURCES
)
61 # Compilation and linking
62 ######################################
64 OBJS
=$(subst .c
,.o
,$(SOURCES
) $(EXPORTS_C
))
68 ifneq ($(PRELOAD_MODULES
),1)
70 CC_PICFLAGS
=-fPIC
-DPIC
71 LD_SHAREDFLAGS
=-shared
74 $(CC
) $(CC_PICFLAGS
) $(CFLAGS
) -c
$< -o
$@
76 $(MODULE
).so
: $(OBJS
) $(EXT_OBJS
)
77 $(CC
) $(LD_SHAREDFLAGS
) $(LDFLAGS
) $(OBJS
) $(EXT_OBJS
) -o
$@
80 module_install
: module_stub_install
81 $(INSTALLDIR
) $(MODULEDIR
)
82 $(INSTALL
) -m
$(BIN_MODE
) $(MODULE
).so
$(MODULEDIR
)
84 else # PRELOAD_MODULES
90 $(CC
) $(CFLAGS
) -c
$< -o
$@
92 $(MODULE
).a
: $(OBJS
) $(EXT_OBJS
)
93 $(AR
) $(ARFLAGS
) $@
$+
96 module_install
: module_stub_install
98 endif # PRELOAD_MODULES
101 $(INSTALLDIR
) $(LCDIR
)
102 $(INSTALL
) -m
$(DATA_MODE
) $(MODULE
).lc
$(LCDIR
)
107 echo
"ioncore.load_module('$(MODULE)')" |
$(LUAC
) -o
$@
-
110 LUA_SOURCES
+= $(MODULE_STUB
)
118 $(CC
) $(CFLAGS
) -c
$< -o
$@
125 ######################################
128 $(RM
) -f
$(TO_CLEAN
) core
$(DEPEND_FILE
) $(OBJS
)
131 $(RM
) -f
$(TO_REALCLEAN
) $(TARGETS
)
134 ######################################
140 $(INSTALLDIR
) $(LCDIR
)
141 for i in
$(LUA_COMPILED
); do \
142 $(INSTALL
) -m
$(DATA_MODE
) $$i $(LCDIR
); \
146 $(INSTALLDIR
) $(ETCDIR
)
147 for i in
$(ETC
); do \
148 $(INSTALL
) -m
$(DATA_MODE
) $$i $(ETCDIR
); \
152 ######################################
156 _depend
: $(DEPEND_DEPENDS
)
159 ifeq ($(DEPEND_FILE
),$(wildcard $(DEPEND_FILE
)))
160 include $(DEPEND_FILE
)
166 ######################################
171 set
-e
; for i in
$(SUBDIRS
); do
$(MAKE
) -C
$$i; done
174 set
-e
; for i in
$(SUBDIRS
); do
$(MAKE
) -C
$$i depend
; done
177 set
-e
; for i in
$(SUBDIRS
); do
$(MAKE
) -C
$$i clean; done
180 set
-e
; for i in
$(SUBDIRS
); do
$(MAKE
) -C
$$i realclean; done
183 set
-e
; for i in
$(INSTALL_SUBDIRS
); do
$(MAKE
) -C
$$i install; done
188 ######################################
190 TO_CLEAN
+= potfiles_c potfiles_lua
193 echo
"$(SOURCES)"|tr
' ' '\n' > potfiles_c
194 echo
"$(LUA_SOURCES) $(ETC)"|tr
' ' '\n' > potfiles_lua