# General targets for Makefile(s) subsystem. # In this file we will put everything that need to be # shared betweek all the Makefile(s). # This file must be included at the beginning of every Makefile # # Copyright (C) 1999-2002 Riccardo Facchetti # We don't support parallelized makes .NOTPARALLEL: # Tell versions [3.59,3.63) of GNU make not to export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: .SUFFIXES: .o .lo .c .cpp .h .po .gmo .mo .cat .msg .pox .MAIN: all .PHONY: all all-subdirs all-targets install uninstall install- install-apcupsd \ install-powerflute install-cgi install-strip clean realclean distclean \ mostlyclean clobber all: all-subdirs all-targets all-subdirs: @if test ! x"$(subdirs)" = x; then \ for file in . ${subdirs}; \ do \ (cd $$file; \ if test "$$file" != "."; then \ $(MAKE) DESTDIR=$(DESTDIR) all || exit $$?; \ fi; \ ) || exit $$?; \ done; \ fi # Standard compilation targets dummy: .c.o: $(CXX) -c $(CPPFLAGS) $(DEFS) $< .c.lo: $(LIBTOOL) --mode=compile $(COMPILE) $< .cpp.o: $(CXX) -c $(CPPFLAGS) $(DEFS) $< .po.pox: $(MAKE) DESTDIR=$(DESTDIR) $(PACKAGE).pot $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox .po.mo: $(MSGFMT) -o $@ $< .po.gmo: file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \ && rm -f $$file && $(GMSGFMT) -o $$file $< .po.cat: sed -f $(topdir)/src/intl/po2msg.sed < $< > $*.msg \ && rm -f $@ && $(GENCAT) $@ $*.msg # Library targets $(topdir)/src/lib/libapc.a: $(topdir)/src/lib/*.[ch] @(cd $(topdir)/src/lib && $(MAKE)) $(topdir)/src/drivers/libdrivers.a: $(topdir)/src/drivers/*.[ch] @(cd $(topdir)/src/drivers && $(MAKE)) $(topdir)/src/drivers/apcsmart/libapcsmart.a: $(topdir)/src/drivers/apcsmart/*.[ch] @(cd $(topdir)/src/drivers/apcsmart && $(MAKE)) $(topdir)/src/drivers/dumb/libdumb.a: $(topdir)/src/drivers/dumb/*.[ch] @(cd $(topdir)/src/drivers/dumb && $(MAKE)) $(topdir)/src/drivers/net/libnet.a: $(topdir)/src/drivers/net/*.[ch] @(cd $(topdir)/src/drivers/net && $(MAKE)) $(topdir)/src/drivers/usb/libusb.a: $(topdir)/src/drivers/usb/*.[ch] @(cd $(topdir)/src/drivers/usb && $(MAKE)) $(topdir)/src/drivers/snmp/libdumb.a: $(topdir)/src/drivers/snmp/*.[ch] @(cd $(topdir)/src/drivers/snmp && $(MAKE)) $(topdir)/src/drivers/test/libtest.a: $(topdir)/src/drivers/test/*.[ch] @(cd $(topdir)/src/drivers/test && $(MAKE)) $(topdir)/src/drivers/pcnet/libpcnet.a: $(topdir)/src/drivers/pcnet/*.[ch] @(cd $(topdir)/src/drivers/pcnet && $(MAKE)) $(topdir)/src/intl/libintl.a: $(topdir)/src/intl/*.[ch] @(cd $(topdir)/src/intl && $(MAKE)) $(topdir)/src/gd1.2/libgd.a: $(topdir)/src/gd1.2/*.[ch] @(cd $(topdir)/src/gd1.2 && $(MAKE)) # Makefile subsystem targets $(topdir)/autoconf/variables.mak: $(topdir)/autoconf/variables.mak.in @(cd $(topdir) && \ SINGLE_MAKEFILE=yes \ CONFIG_FILES=./autoconf/variables.mak \ CONFIG_HEADERS= $(SHELL) ./config.status) Makefiles: @(cd $(topdir) && \ $(SHELL) ./config.status) Makefile: $(srcdir)/Makefile.in $(topdir)/config.status \ $(topdir)/autoconf/variables.mak $(topdir)/autoconf/targets.mak @$(abssrcdir)/autoconf/rebuild-makefile.sh $(abssrcdir) @echo "You can ignore any makedepend error messages" @$(MAKE) DESTDIR=$(DESTDIR) single-depend # Configuration targets configure: $(topdir)/autoconf/configure.in $(topdir)/autoconf/aclocal.m4 \ $(topdir)/autoconf/acconfig.h $(topdir)/autoconf/config.h.in cd $(topdir); $(RMF) config.cache config.log config.out config.status include/config.h autoconf --prepend-include=$(topdir)/autoconf \ autoconf/configure.in > configure chmod 755 configure $(topdir)/autoconf/config.h.in: $(topdir)/autoconf/configure.in \ $(topdir)/autoconf/acconfig.h # cd $(srcdir); # autoheader --prepend-include=$(srcdir)/autoconf \ # autoconf/configure.in > autoconf/config.h.in # chmod 644 autoconf/config.h.in $(topdir)/config.status: @if test -x $(topdir)/config.status; then \ (cd $(topdir) && \ $(SHELL) ./config.status --recheck); \ else \ (cd $(topdir) && \ $(SHELL) ./configure); \ fi clean-subdirs: @if test ! x"$(subdirs)" = x; then \ for file in . ${subdirs}; \ do \ (cd $$file && if test "$$file" != "."; then $(MAKE) clean; fi); \ done; \ fi distclean-subdirs: @if test ! x"$(subdirs)" = x; then \ for file in . ${subdirs}; \ do \ (cd $$file && if test "$$file" != "."; then $(MAKE) distclean; fi); \ done; \ fi targetclean: clean-subdirs $(RMF) *.o *.lo *.a core core.* .*~ *~ *.bak $(RMF) *.exe *.res *.cgi $(RMF) 1 2 3 4 ID TAGS *.orig $(allexe) targetdistclean: clean distclean-subdirs mostlyclean: clean realclean: distclean clobber: distclean # Semi-automatic generation of dependencies: # Use gcc if possible because X11 `makedepend' doesn't work on all systems # and it also includes system headers. # Also test for the presence of source files: if not present, do nothing. depend: @if test "`$(topdir)/autoconf/has-c-files.sh`" = "no"; then \ $(ECHO) "Nothing to do for depend."; \ else \ $(MAKE) real-depend; \ fi @if test ! x"$(subdirs)" = x; then \ for file in . ${subdirs}; \ do \ (cd $$file && if test "$$file" != "."; then $(MAKE) depend; fi); \ done; \ fi single-depend: @if test "`$(topdir)/autoconf/has-c-files.sh`" = "no"; then \ $(ECHO) "Nothing to do for depend."; \ else \ $(MAKE) real-depend; \ fi real-depend: @$(RMF) Makefile.bak @if test `basename "$(CXX)"` = "g++" ; then \ $(MV) Makefile Makefile.bak; \ $(SED) "/^# DO NOT DELETE THIS LINE/,$$ d" Makefile.bak > Makefile; \ $(ECHO) "# DO NOT DELETE THIS LINE -- make depend depends on it." >> Makefile; \ $(CXX) -S -M $(CPPFLAGS) $(INCFLAGS) *.c >> Makefile; \ else \ makedepend -- $(CFLAGS) -- $(INCFLAGS) *.c; \ fi @if test -f Makefile ; then \ $(RMF) Makefile.bak; \ else \ $(MV) Makefile.bak Makefile; \ echo -e "Something went wrong with the make depend!\n\a\a\a\a"; \ fi install-subdirs: @if test ! x"$(subdirs)" = x; then \ for file in . ${subdirs}; \ do \ (cd $$file && if test "$$file" != "."; then $(MAKE) STRIP=$(STRIP) DESTDIR=$(DESTDIR) install; fi); \ done; \ fi uninstall-subdirs: @if test ! x"$(subdirs)" = x; then \ for file in . ${subdirs}; \ do \ (cd $$file && if test "$$file" != "."; then $(MAKE) DESTDIR=$(DESTDIR) uninstall; fi); \ done; \ fi install-strip: @$(MAKE) STRIP='-s' install indent: (cd $(topdir) && \ find . \( -name '*.c' -o -name '*.h' -o -name '*.cpp' \) \ -exec ./scripts/format_code {} \;) TAGS: (cd $(topdir) && $(ETAGS) `find . \( -name \*.c -o -name \*.h \)`) tags: (cd $(topdir) && $(CTAGS) `find . \( -name \*.c -o -name \*.h \)`)