diff --git a/Makefile b/Makefile index fd5dacc..9449ca9 100644 --- a/Makefile +++ b/Makefile @@ -37,14 +37,21 @@ RM = rm -f LN = ln INSTALL = install +# Uncomment this to see all build commands instead of 'quiet' output +#NOISY_BUILD=yes + # XXX missing terms since currently no term modules MOD_SUBDIR:=doors modules nets SUBDIRS:=$(MOD_SUBDIR) SUBDIRS_INSTALL:=$(SUBDIRS:%=%-install) SUBDIRS_CLEAN:=$(SUBDIRS:%=%-clean) -# SUBMAKE:=$(MAKE) --quiet --no-print-directory +ifneq ($(PRINT_DIR)$(NOISY_BUILD),) SUBMAKE:=$(MAKE) +else +SUBMAKE:=$(MAKE) --quiet --no-print-directory +endif + MOD_SUBDIR_CFLAGS="-I$(BBSTOPDIR)/include" # MODULE_PREFIX:=mod @@ -52,6 +59,8 @@ MAIN_SOURCES := $(wildcard *.c) $(cami/wildcard *.c) INCLUDE_FILES := $(wildcard include/*.h) MAIN_OBJ = $(MAIN_SOURCES:.c=.o) +SILENT_BUILD_PREFIX := @ + # ALL_C_MODS+=$(foreach p,$(MOD_SUBDIR)/$(MODULE_PREFIX),$(patsubst %.c,%.so,$(wildcard $(p)_*.c))) export CC @@ -62,23 +71,22 @@ export LIBS export SUBMAKE +# Run sub targets in parallel, but don't run top-level targets in parallel +.NOTPARALLEL: + # This is the first target, so it's the default for just "make": all : bbs $(MOD_SUBDIR) external @echo " +--------- LBBS has been compiled ---------+" @echo " You may now install it by running make install" bbs : $(MAIN_OBJ) - @echo " +--------- make bbs ---------+" - $(SUBMAKE) --no-builtin-rules -C $@ all + @+$(SUBMAKE) --no-builtin-rules -C $@ all $(MOD_SUBDIR): - @echo " +--------- make $@ ---------+" -# $(SUBMAKE) --no-builtin-rules -C $@ SUBDIR=$@ all - $(SUBMAKE) --no-builtin-rules -C $@ all + @+$(SUBMAKE) --no-builtin-rules -C $@ all external tests : - @echo " +--------- make $@ ---------+" - $(SUBMAKE) --no-builtin-rules -C $@ all + @+$(SUBMAKE) --no-builtin-rules -C $@ all modcheck : external @external/modman -t diff --git a/bbs/Makefile b/bbs/Makefile index 6d05977..64232e1 100644 --- a/bbs/Makefile +++ b/bbs/Makefile @@ -9,7 +9,7 @@ INC = -I.. all: $(EXE) $(EXE) : $(MAIN_OBJ) - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) $(CFLAGS) -Wl,--export-dynamic -o $(EXE) *.o $(LIBS) -include $(DEPENDS) @@ -18,7 +18,7 @@ $(EXE) : $(MAIN_OBJ) $(DEPENDS): %.o : %.c %.d - @echo "== Compiling bbs/$@" + @echo " [CC] $< -> $@" $(CC) $(CFLAGS) -DBBS_IN_CORE -MMD -MP $(INC) -c $< # Don't automatically remove intermediate .o files, to prevent unnecessary recompilations diff --git a/doors/Makefile b/doors/Makefile index b890dcf..d21b2cd 100644 --- a/doors/Makefile +++ b/doors/Makefile @@ -7,22 +7,21 @@ DEPENDS := $(patsubst %.c,%.d,$(MOD_SRC)) INC = -I.. all: $(MOD_SO) - @echo "== Compiling doors" -include $(DEPENDS) $(DEPENDS): %.o : %.c %.d - @echo "== Compiling $@" + @echo " [CC] $< -> $@" $(CC) $(CFLAGS) -fPIC -DBBS_MODULE=\"$(basename $<)\" -DBBS_MODULE_SELF_SYM=__internal_$(basename $<)_self -MMD -MP $(INC) -c $< %.so : %.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ door_irc.so : door_irc.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lirc # Don't automatically remove intermediate .o files, to prevent unnecessary recompilations diff --git a/external/Makefile b/external/Makefile index 8ca54f4..b5041c5 100644 --- a/external/Makefile +++ b/external/Makefile @@ -14,9 +14,11 @@ all: $(EXES) # XXX: This is not quite right, as it recreates all binaries whenever an object file needs to be recreated. # What we really want to do is have each EXE depend on its corresponding OBJ file (with .o extension) $(EXES): $(OBJS) + @echo " [LD] $@.o -> $@" $(CC) $(CFLAGS) -o $@ $@.o %.o : %.c + @echo " [CC] $< -> $@" $(CC) $(CFLAGS) -c $^ install : all diff --git a/modules/Makefile b/modules/Makefile index 2063bf2..6137d7b 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -13,79 +13,78 @@ MYSQL_LIBS := $(shell mysql_config --libs) ETPANCFLAGS=-I/usr/local/include all: $(MOD_SO) - @echo "== Compiling modules" -include $(DEPENDS) $(DEPENDS): %.o : %.c %.d - @echo "== Compiling $@" + @echo " [CC] $< -> $@" $(CC) $(CFLAGS) -fPIC -DBBS_MODULE=\"$(basename $<)\" -DBBS_MODULE_SELF_SYM=__internal_$(basename $<)_self -MMD -MP $(INC) -c $< touch $@ mod_mimeparse.o : mod_mimeparse.c mod_mimeparse.d - @echo "== Compiling $@" + @echo " [CC] $< -> $@" $(CC) $(CFLAGS) -fPIC -DBBS_MODULE=\"$(basename $<)\" -DBBS_MODULE_SELF_SYM=__internal_$(basename $<)_self $(GMIME_FLAGS) -MMD -MP $(INC) -c $< %.so : %.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ mod_asterisk_ami.so : mod_asterisk_ami.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lcami mod_asterisk_queues.so : mod_asterisk_queues.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lcami mod_discord.so : mod_discord.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -ldiscord mod_http.so : mod_http.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lmagic mod_irc_client.so : mod_irc_client.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lirc mod_lmdb.so : mod_lmdb.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -llmdb mod_mimeparse.so : mod_mimeparse.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ $(GMIME_LIBS) mod_mysql.so : mod_mysql.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ $(MYSQL_LIBS) mod_ncurses.so : mod_ncurses.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lmenu -lncurses mod_oauth.so : mod_oauth.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -ljansson mod_operator.so : mod_operator.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -ljansson mod_sieve.so : mod_sieve.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lsieve mod_slack.so : mod_slack.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lslackrtm mod_smtp_delivery_external.so : mod_smtp_delivery_external.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" ifeq ($(UNAME_S),FreeBSD) $(CC) -shared -fPIC -o $(basename $^).so $^ else @@ -93,27 +92,27 @@ else endif mod_smtp_filter_arc.so : mod_smtp_filter_arc.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -L/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib -lopenarc mod_smtp_filter_dkim.so : mod_smtp_filter_dkim.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lopendkim mod_smtp_filter_dmarc.so : mod_smtp_filter_dmarc.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lopendmarc mod_smtp_filter_spf.so : mod_smtp_filter_spf.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lspf2 mod_webmail.o : mod_webmail.c mod_webmail.d - @echo "== Compiling $@" + @echo " [CC] $< -> $@" $(CC) $(CFLAGS) -funsigned-char -fPIC -DBBS_MODULE=\"$(basename $<)\" -DBBS_MODULE_SELF_SYM=__internal_$(basename $<)_self -MMD -MP $(INC) $(ETPANCFLAGS) -c $< mod_webmail.so : mod_webmail.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -ljansson -lssl -lcrypto -ldb-5.3 -lz -L/usr/local/lib -Wl,-rpath=/usr/local/lib/ -letpan # Don't automatically remove intermediate .o files, to prevent unnecessary recompilations diff --git a/nets/Makefile b/nets/Makefile index f18942d..0249213 100644 --- a/nets/Makefile +++ b/nets/Makefile @@ -14,18 +14,17 @@ ifneq ($(SFTP_SERVER_FREE_EXISTS),0) endif all: $(MOD_SO) - @echo "== Compiling nets" -include $(DEPENDS) $(DEPENDS): %.o : %.c %.d - @echo "== Compiling $@" + @echo " [CC] $< -> $@" $(CC) $(CFLAGS) -fPIC -DBBS_MODULE=\"$(basename $<)\" -DBBS_MODULE_SELF_SYM=__internal_$(basename $<)_self -MMD -MP $(INC) -c $< %.so : %.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ IMAP_SRC = $(wildcard net_imap/*.c) @@ -33,20 +32,19 @@ IMAP_OBJ = $(patsubst %.c,%.o,$(IMAP_SRC)) # Subdirectory with components for net_imap net_imap: - @echo " +--------- make $@ ---------+" - $(SUBMAKE) --no-builtin-rules -C $@ all + @+$(SUBMAKE) --no-builtin-rules -C $@ all net_imap.so : net_imap.o net_imap - @echo "== Linking $@" + @echo " [LD] $< $(IMAP_OBJ) -> $@" $(CC) -shared -fPIC -o $(basename $<).so $(IMAP_OBJ) $< # SSHLIB=$(pkg-config --libs libssh) net_ssh.so : net_ssh.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lssh net_ws.so : net_ws.o - @echo "== Linking $@" + @echo " [LD] $^ -> $@" $(CC) -shared -fPIC -o $(basename $^).so $^ -lwss # Don't automatically remove intermediate .o files, to prevent unnecessary recompilations diff --git a/nets/net_imap/Makefile b/nets/net_imap/Makefile index f2ce99a..e3c2d52 100644 --- a/nets/net_imap/Makefile +++ b/nets/net_imap/Makefile @@ -7,14 +7,13 @@ DEPENDS := $(patsubst %.c,%.d,$(IMAP_SRC)) INC = -I../.. all: $(MOD_SO) - @echo "== Compiling net_imap components" -include $(DEPENDS) $(DEPENDS): %.o : %.c %.d - @echo "== Compiling $@" + @echo " [CC] $< -> $@" $(CC) $(CFLAGS) -fPIC -DBBS_MODULE_SUBFILE -MMD -MP $(INC) -c $< all: $(IMAP_OBJ)