--- a/rules.mk Sat Apr 05 22:24:03 2003 +0200 +++ b/rules.mk Sat Apr 05 22:32:55 2003 +0200 @@ -4,13 +4,22 @@ ###################################### +ifdef MODULE +ifneq ($(STATIC_MODULES),1) +TARGETS := $(TARGETS) $(MODULE).so +else +TARGETS := $(TARGETS) $(MODULE).a +endif +endif + + ifdef SUBDIRS all: subdirs $(TARGETS) clean: subdirs-clean _clean -realclean: subdirs-realclean _realclean +realclean: subdirs-realclean _clean _realclean depend: subdirs-depend _depend @@ -20,7 +29,7 @@ clean: _clean -realclean: _realclean +realclean: _clean _realclean depend: _depend @@ -38,29 +47,66 @@ ###################################### +OBJS=$(subst .c,.o,$(SOURCES)) + +ifdef MAKE_EXPORTS + +TO_CLEAN := $(TO_CLEAN) exports.c + +OBJS := $(OBJS) exports.o + +exports.c: $(SOURCES) + $(PERL) $(TOPDIR)/mkexports.pl $(MAKE_EXPORTS) exports.c $(SOURCES) + +endif + +ifdef MODULE + +ifneq ($(STATIC_MODULES),1) + +$(MODULE).so: $(OBJS) $(EXT_OBJS) + $(CC) $(CFLAGS) $(LDFLAGS) $(MODULE_LDFLAGS) $(OBJS) $(EXT_OBJS) -o $@ + +module_install: + $(INSTALLDIR) $(MODULEDIR) + $(INSTALL) -m $(BIN_MODE) $(MODULE).so $(MODULEDIR) + # $(STRIP) $(MODULEDIR)/$(MODULE).so + +else + +$(MODULE).a: $(OBJS) + $(AR) $(ARFLAGS) $@ $+ + $(RANLIB) $@ + +module_install: + +endif + +.c.o: + $(CC) $(CFLAGS) $(MODULE_CFLAGS) -c $< -o $@ + +else + .c.o: $(CC) $(CFLAGS) -c $< -o $@ -ifdef OBJS +endif _clean: - rm -f core $(DEPEND_FILE) $(OBJS) + rm -f core $(DEPEND_FILE) $(OBJS) $(TO_CLEAN) -_depend: - $(MAKE_DEPEND) *.c +_realclean: + rm -f $(TARGETS) $(TO_REALCLEAN) + +ifdef SOURCES +_depend: + $(MAKE_DEPEND) $(SOURCES) else - -_clean: - _depend: endif -_realclean: _clean - rm -f $(TARGETS) - - ###################################### subdirs: