# -*- Makefile -*- # DROPS Make configuration file # # created 1996/04/20 by hohmuth # $Id: Makeconf,v 1.6 2003/03/01 21:09:47 hohmuth Exp $ # ifdef NDEBUG CPPFLAGS+= -DNDEBUG endif ifdef DEBUG CPPFLAGS+= -DDEBUG endif ifdef OPT CPPFLAGS+= -O$(OPT) else CPPFLAGS+= -O2 endif ifdef ASM CPPFLAGS+= -S endif ifdef PRE CPPFLAGS+= -E endif #CC= gcc #CXX= g++ AS= as LD= ld AR= ar NM= nm RANLIB= ranlib SIZE= size STRIP= strip OBJCOPY=objcopy RM= rm -f CP= cp INSTALL=install PWD= pwd INDENT= indent -sob YACC= byacc LEX= flex ALL_LIBDIR= ALL_INCDIR= $(addprefix -I, \ $(PRIVATE_INCDIR)) OBJS = $(SRC_S:.S=.o) $(SRC_CPP:.cpp=.o) $(SRC_C:.c=.o) $(SRC_CC:.cc=.o) OBJS_P = $(SRC_S:.S=.p.o) $(SRC_CPP:.cpp=.p.o) $(SRC_C:.c=.p.o) $(SRC_CC:.cc=.p.o) OBJS_PR = $(SRC_S:.S=.pr.o) $(SRC_CPP:.cpp=.pr.o) $(SRC_C:.c=.pr.o) $(SRC_CC:.cc=.pr.o) OBJS_SO = $(SRC_S:.S=.p.o) $(SRC_CPP:.cpp=.p.o) $(SRC_C:.c=.p.o) $(SRC_CC:.cc=.p.o) SRC_ALL = $(SRC_S) $(SRC_CPP) $(SRC_C) $(SRC_CC) ifeq ($(filter clean cleanall,$(MAKECMDGOALS)),) DEPS = $(foreach file,$(SRC_ALL), $(dir $(file)).$(notdir $(file)).d) else DEPS = /dev/null endif #LIBDEPS = $(foreach file, \ # $(patsubst -l%,lib%.a,$(filter-out -L%,$(L4_LIB))) \ # $(patsubst -l%,lib%.so,$(filter-out -L%,$(L4_LIB))),\ # $(word 1, $(foreach dir, \ # $(patsubst -L%,%,\ # $(filter -L%,$(L4_LIB) $(ALL_LIBDIR))),\ # $(wildcard $(dir)/$(file))))) CPPFLAGS += $(ALL_INCDIR) \ $(INCLUDES) # output formating # set VERBOSE=@ to prevent command lines VERBOSE= COMP_MESSAGE= @echo -e " ... Making $@" COMP_P_MESSAGE= @echo -e " ... Making PIC $@" COMP_PR_MESSAGE=@echo -e " ... Making PROFILE $@" LINK_MESSAGE= @echo -e " ==> Linking $@" DEP_MESSAGE= @echo -e " ... Building dependencies for $<" CLEAN_MESSAGE= @echo -e "Removing created files" CLEANALL_MESSAGE=@echo -e "Removing all created files" INST_MESSAGE= @echo -e "Installing $(^F)" DEPEND_VERBOSE= @ DEPEND_EXTEND_CMD = perl -ne ' \ /^[^:]*: ..*/ && do { \ while(/\\$$/){ \ $$_ .= <>; \ } \ chomp; \ @field = /(.*?): (.*)/s; \ $$field[0] =~ s/$*.o/$$& $*.p.o $*.pr.o $*.s $*.E $@/; \ printf("ifneq (\$$(wildcard %s), %s)\n%s: FORCE\nelse\n%s: %s Makefile\nendif\n",\ $$field[1],$$field[1],$$field[0],$$field[0],$$field[1]); \ } or print' < $(1) > $(2).new && rm -f $(1) && mv $(2).new $(2) .PHONY: FORCE %.o: %.cc $(COMP_MESSAGE) $(VERBOSE)$(CXX) -c -MD $(CPPFLAGS) $(CXXFLAGS) $< -o $@ $(DEPEND_VERBOSE)$(call DEPEND_EXTEND_CMD, $*.d, .$*.cc.d) %.o: %.c $(COMP_MESSAGE) $(VERBOSE)$(CC) -c -MD $(CPPFLAGS) $(CFLAGS) $< -o $@ $(DEPEND_VERBOSE)$(call DEPEND_EXTEND_CMD, $*.d, .$*.c.d) %.p.o: %.c $(COMP_P_MESSAGE) $(VERBOSE)$(CC) -c -MD $(CPPFLAGS) $(CFLAGS) -fPIC $< -o $@ $(DEPEND_VERBOSE)$(call DEPEND_EXTEND_CMD, $*.d, .$*.c.d) %.pr.o: %.c $(COMP_PR_MESSAGE) $(VERBOSE)$(CC) -c -MD $(CPPFLAGS) $(CFLAGS) -DPROFILE -pg $< -o $@ $(DEPEND_VERBOSE)$(call DEPEND_EXTEND_CMD, $*.d, .$*.c.d) %.o: %.S $(COMP_MESSAGE) $(VERBOSE)$(CC) -c -MD $(CPPFLAGS) $< -o $@ $(DEPEND_VERBOSE)$(call DEPEND_EXTEND_CMD, $*.d, .$*.S.d) %.p.o: %.S $(COMP_MESSAGE) $(VERBOSE)$(CC) -c -MD $(CPPFLAGS) -fPIC $< -o $@ $(DEPEND_VERBOSE)$(call DEPEND_EXTEND_CMD, $*.d, .$*.S.d) %.pr.o: %.S $(COMP_MESSAGE) $(VERBOSE)$(CC) -c -MD $(CPPFLAGS) -DPROFILE -pg $< -o $@ $(DEPEND_VERBOSE)$(call DEPEND_EXTEND_CMD, $*.d, .$*.S.d) %: %.o $(LINK_MESSAGE) $(VERBOSE)$(LD) $(LDFLAGS) -o $@ crt0.o $< %.E: %.c $(COMP_MESSAGE) $(VERBOSE)$(CC) -E $(CPPFLAGS) $(CFLAGS) $< -o $@ $(VERBOSE)$(INDENT) -o $@ $@ %.E: %.cc $(COMP_MESSAGE) $(VERBOSE)$(CC) -E $(CPPFLAGS) $(CXXFLAGS) $< -o $@ $(VERBOSE)$(INDENT) -sob -o $@ $@ %.S: %.c $(COMP_MESSAGE) $(VERBOSE)$(CC) -S $(CFLAGS) $(CPPFLAGS) $< -o $@ -include $(srcdir)/Makeconf.local ifeq ($(USE_EMPHASIZE_PHASES),1) ifneq (,$(findstring ${TERM},vt100 xterm linux console)) EMPHSTART = '\033[34m' EMPHSTOP = '\033[0m' else EMPHSTART = EMPHSTOP = endif endif # Compiler options for both C and C++ (later folded into both CFLAGS # and CXXFLAGS) #ifeq ($(NOSTDL4),) GCC_FLAGS = -g -Wall -Wstrict-prototypes -Wmissing-prototypes \ -Wmissing-declarations #else # GCC_FLAGS = -g -Wall -Wstrict-prototypes #endif # only work around strength reduction bug(s) on older gcc versions GCC_FLAGS += $(shell PATH=$(PATH); if ! $(CC) -S -march=i486 -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-fno-strength-reduce"; fi) CFLAGS= $(GCC_FLAGS) CXXFLAGS= $(GCC_FLAGS)