# # Rules.make: common makefile rules for oasys / DTN2 # # # Targets are "native" and "arm" # TARGET = @TARGET@ # # Common settings extracted from the configure script # prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ CC = @CC@ CXX = @CXX@ DEPFLAGS = @DEPFLAGS@ DEBUG = @DEBUG@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ OPTIMIZE = @OPTIMIZE@ PROFILE = @PROFILE@ CPPFLAGS = -I$(SRCDIR) -I$(BUILDDIR) @CPPFLAGS@ WARN = -Wall -Werror @OPTIMIZE_WARN@ CFLAGS = $(CPPFLAGS) $(DEBUG) $(OPTIMIZE) $(DEPFLAGS) $(WARN) $(PROFILE) LIBS = @LIBS@ LDFLAGS = @LDFLAGS@ # # Add a phony rule to make sure this isn't included before the default # .PHONY: catchdefault catchdefault: @echo "Rules.make should be included after the default rule is set" @exit 1 # # Rule for generating a .o file from the corresponding .cc file; # automatically creates dependencies via the dependency flags. # %.o: %.cc @rm -f $@; mkdir -p $(@D) $(CXX) $(CFLAGS) -c $< -o $@ %.o: %.c @rm -f $@; mkdir -p $(@D) $(CC) $(CFLAGS) -c $< -o $@ # # Generate cpp output in .E files. # %.E: %.cc @rm -f $@; mkdir -p $(@D) $(CXX) $(CFLAGS) -c $< -E -o $@ %.E: %.c @rm -f $@; mkdir -p $(@D) $(CXX) $(CFLAGS) -c $< -E -o $@ # # Make stripped binaries from debug binaries # %.stripped: %.exe cp $< $@ && strip $@ # # Always include all the .d files that we can find, based on all the # source files we can find (unless they're specified). # ifeq ($(ALLSRCS),) ALLSRCS := $(shell find . -name \*.cc -o -name \*.c) endif DEPFILES := $(ALLSRCS:%.cc=%.d) DEPFILES := $(DEPFILES:%.c=%.d) ifneq ($(DEPFILES),) -include $(DEPFILES) endif echosrcdir: @echo "srcdir: $(SRCDIR)" echodep: @echo "allsrcs: $(ALLSRCS)" @echo "depfiles: $(DEPFILES)" # # Some rules for cleaning object files # clean: $(SUBDIRS) objclean depclean genclean libclean binclean .PHONY: $(SUBDIRS) $(SUBDIRS): $(MAKE) -w -C $@ $(MAKECMDGOALS) .PHONY: objclean objclean: @echo "removing object files..." @find . \( -name '*.[Eo]' \) -print | xargs rm -f .PHONY: depclean depclean: @test -z "$(DEPFILES)" || \ echo "removing dependency files..." && \ rm -f $(DEPFILES) .PHONY: genclean genclean: @test -z "$(GENFILES)" || \ echo "removing generated files: $(GENFILES)..." && \ rm -f $(GENFILES) .PHONY: libclean libclean: @test -z "$(LIBFILES)" || \ echo "removing library files: $(LIBFILES)..." && \ rm -f $(LIBFILES) .PHONY: binclean binclean: @test -z "$(BINFILES)" || \ echo "removing binary files: $(BINFILES)..." && \ rm -f $(BINFILES) .PHONY: distclean CFGFILES := Rules.make config.h config.cache distclean: clean @echo "removing configure generated files: $(CFGFILES)..." @test -z "$(CFGFILES)" || rm -f $(CFGFILES)