# -*- mode: mak; -*- ############################################################################### # File: TOOLSET/djgpp.rul[e] # Contents: DJGPP rules # # Revision History: # 06/02/00 APY Created # 25/06/00 APY - __SOURCE__ # - updated gcc_depend ############################################################################### ############################################################################### #.. Remove "undef" warnings # cc_includes += cc_defines += cxx_includes += cxx_defines += as_includes += as_defines += ############################################################################### #.. C Compiler definition # cc = @gcc cc_init = cc_o_switch = cc_object = -o $@ cc_source = $< cc_cmdfile = $(basename $@).cmd cc_flags = @$(cc_cmdfile) gcc_includes += $(usr)/include gcc_flags = -Wall -c ifeq "$(DEBUG)" "1" gcc_flags += -g -O -DDEBUG else gcc_flags += -O2 endif ifdef ALVL gcc_flags += -DALVL=$(ALVL) endif ifdef DLVL gcc_flags += -DDLVL=$(DLVL) endif wc_flags += -D__SOURCE__=\"$(notdir $<)\" ifdef LEAVETMP gcc_flags += -save-temps endif define cc_pre @echo [\$<] compiling..; \ $(cmdfile) -ko$(cc_cmdfile) "\ $(patsubst %,%\\n,$(CFLAGS)) \ $(patsubst %,-D%\\n,$(cc_defines)) \ $(patsubst %,%\\n,$(gcc_flags)) \ $(patsubst %,-I %\\n,$(INCDIRS)) \ $(patsubst %,-I %\\n,$(cc_includes)) \ $(patsubst %,-I %\\n,$(gcc_includes)) \ $(cc_object)" endef ifndef LEAVETMP define cc_post @$(rm) -f $(cc_cmdfile) endef else define cc_post endef endif ############################################################################### #.. C/C++ dependencies # depend and depend.err # gcc_depend = -D__GNUC__=2 -D__STDC__ gcc_depend = -Dunix -Di386 -DGO32 -DDJGPP=2 -DMSDOS ifeq "$(DEBUG)" "1" gcc_depend += -DDEBUG endif ifdef ALVL gcc_depend += -DALVL=$(ALVL) endif ifdef DLVL gcc_depend += -DDLVL=$(DLVL) endif ccdep = @$(SCM_BIN)/mkdepend ccdep_init = ccdep_o_switch = -o.${o} -f - ccdep_source = $(filter %.c %.cc %.cpp, $+) > $(subst /,\\,$@) 2> $@.err ccdep_flags = -MM \ $(patsubst %,%,$(CFLAGS)) \ $(patsubst %,-D%,$(cc_defines)) \ $(patsubst %,%,$(gcc_depend)) \ $(patsubst %,-I %,$(INCDIRS)) \ $(patsubst %,-I %,$(cc_includes)) \ $(patsubst %,-Y %,$(gcc_includes)) ccdep_pre = ccdep_post = #.. C++ Compiler definition # cxx = @gcc cxx_init = cxx_o_switch = cxx_object = -o $@ cxx_source = $< cxx_cmdfile = $(basename $@).cmd cxx_flags = @$(cxx_cmdfile) define cxx_pre @echo [\$<] compiling.. @$(cmdfile) -ko$(cxx_cmdfile) "\ $(patsubst %,%\\n,$(CXXFLAGS)) \ $(patsubst %,-d%\\n,$(cxx_defines)) \ $(patsubst %,%\\n,$(gcc_flags)) \ $(patsubst %,-i=%\\n,$(INCDIRS)) \ $(patsubst %,-i=%\\n,$(cxx_includes)) \ $(patsubst %,-i=%\\n,$(gcc_includes)) \ $(subst /,\\\\,$(cxx_object))" endef ifndef LEAVETMP define cxx_post @$(rm) -f $(cxx_cmdfile) endef else define cxx_post endef endif ############################################################################### #.. Assembler definition # #.. Assembler (GCC) # as = @gcc as_init = as_i_switch = -I$(space) as_o_switch = as_object = -o $@ as_source = $< as_cmdfile = $(basename $@).cmd as_flags = @$(as_cmdfile) gas_flags = -Wall -x assembler-with-cpp -c ifeq "$(DEBUG)" "1" gas_flags += -g -DDEBUG endif ifdef DLVL gas_flags += -DDLVL=$(DLVL) endif ifdef ALVL gas_flags += -DALVL=$(ALVL) endif as_defines := $(addprefix -D,$(as_defines)) as_defines += $(gas_flags) define as_pre @$(cmdfile) -ko$(as_cmdfile) "\ $(patsubst %,%\\n,$(ASFLAGS)) \ $(patsubst %,%\\n,$(as_defines)) \ $(patsubst %,$(as_i_switch)%\\n,$(INCDIRS)) \ $(patsubst %,$(as_i_switch)%\\n,$(as_includes)) \ $(as_object)\\n" endef ifndef LEAVETMP define as_post @$(rm) -f $(as_cmdfile) endef else define as_post endef endif #.. Archiver # ar = ar ar_cmdfile = $(basename $@).ar ar_flags = -cvr ar_o_switch = $@ @$(ar_cmdfile) define ar_pre @rm -f $@ @$(cmdfile) -ko$(ar_cmdfile) \ $(patsubst %,%\\n,$^) endef ifndef LEAVETMP define ar_post @$(rm) -f $(ar_cmdfile) endef else define ar_post endef endif #.. Linker # ld = gcc ld_init = ld_cmdfile = $(basename $@).ld ifeq "$(DEBUG)" "1" ld_flags = -g endif ld_o_switch = @$(ld_cmdfile) define ld_pre @export DJGPP_LIB; \ DJGPP_LIB="$(subst $(space),;,$(LIBDIRS))"; \ $(cmdfile) -ko$(ld_cmdfile) "$($(notdir $(basename $@))_ld)" endef ifndef LEAVETMP define ld_post @$(rm) -f $(ld_cmdfile) endef else define ld_post endef endif define LDDEPEND @export DJGPP_LIB; \ DJGPP_LIB="$(subst $(space),;,$(LIBDIRS))"; \ $(cmdfile) -ko$(BINDIR)/$(notdir $(basename $@)).dep "$($(notdir $(basename $@))_dp)" endef #