View Revisions: Issue #740

Summary 0000740: improve makefile generation to include use static pattern rules
Revision 2016-08-20 19:45 by redj
Additional Information
Revision 2012-04-08 03:59 by redj
Additional Information // .ec files that use specific flags should be grouped by flags signature and be handled as follow
// each unique flags signature should be given it's own set of flags variables as well as it own file list
// CFLAGS-C1, OFLAGS-C1, ECFLAGS-C1
// ECSOURCES-C1
// proper static rules should be generated for each flags signature like this:
f.Printf("# STATIC PATTERN RULES\n");
f.Printf("\n");
f.Printf("$(SYMBOLS-C1): %%$(S): %%$(P)\n");
f.Printf(" $(ECP) $(CECFLAGS-C1) $(ECFLAGS-C1) $(CFLAGS-C1) -c $< -o $@\n");
f.Printf("\n");
f.Printf("$(COBJECTS-C1): %%$(T): %%$(P) %%$(S) | $(SYMBOLS)\n");
f.Printf(" $(ECC) $(CECFLAGS-C1) $(ECFLAGS-C1) $(CFLAGS-C1) $(FVISIBILITY) -c $< -o $@ -symbols $(OBJ)\n");
f.Printf("\n");
f.Printf("$(OBJECTS-C1): %%$(O): %%$(T)\n");
f.Printf(" $(CC) $(CFLAGS-C1) $(FVISIBILITY-C1) -c $< -o $@\n");
f.Printf("\n");
// custom flags signature file lists should be combined in a master list
// ECSOURCES-ALL-CUSTOM = $(ECSOURCES-C1) [$(ECSOURCES-C2) [...]]
// lists of non-custom (common) flags signature files should be generated
// ECSOURCES-COMMON = $(call shwspace,$(filter-out $(_ECSOURCES-ALL-CUSTOM),$(_ECSOURCES)))
// the following lists and possibly more should be generated as needed
// SYMBOLS-COMMON, COBJECTS-COMMON and OBJECTS-COMMON
// SYMBOLS-C1, COBJECTS-C1 and OBJECTS-C1
// need to find list names and write static pattern rules for custom flags
// signature files of other extension than .ec

// when no custom flags files
f.Printf("# STATIC PATTERN RULES\n");
f.Printf("\n");
f.Printf("$(SYMBOLS): %%$(S): %%$(P)\n");
f.Printf(" $(ECP) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) -c $< -o $@\n");
f.Printf("\n");
f.Printf("$(COBJECTS): %%$(T): %%$(P) %%$(S) | $(SYMBOLS)\n");
f.Printf(" $(ECC) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(FVISIBILITY) -c $< -o $@ -symbols $(OBJ)\n");
f.Printf("\n");
f.Printf("$(OBJECTS): %%$(O): %%$(T)\n");
f.Printf(" $(CC) $(CFLAGS) $(FVISIBILITY) -c $< -o $@\n");
f.Printf("\n");

// when custom flags files are present
f.Printf("# STATIC PATTERN RULES\n");
f.Printf("\n");
f.Printf("$(SYMBOLS-COMMON): %%$(S): %%$(P)\n");
f.Printf(" $(ECP) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) -c $< -o $@\n");
f.Printf("\n");
f.Printf("$(COBJECTS-COMMON): %%$(T): %%$(P) %%$(S) | $(SYMBOLS-COMMON)\n");
f.Printf(" $(ECC) $(CECFLAGS) $(ECFLAGS) $(CFLAGS) $(FVISIBILITY) -c $< -o $@ -symbols $(OBJ)\n");
f.Printf("\n");
f.Printf("$(OBJECTS-COMMON): %%$(O): %%$(T)\n");
f.Printf(" $(CC) $(CFLAGS) $(FVISIBILITY) -c $< -o $@\n");
f.Printf("\n");




// check what this is
f.Printf("# IMPLICIT OBJECT RULE\n\n");
f.Printf("$(OBJ)%%$(O) : $(OBJ)%%.c\n");
f.Printf("\t$(CC) $(CFLAGS) $(FVISIBILITY) -c $< -o $@\n\n");


// nice troubleshoot target, improve upon
f.Printf("\n");
f.Printf("troubleshoot:\n");
f.Printf(" @$(call echo,ECSOURCES = $(ECSOURCES))\n");
if(compiler.separatePreprocessing)
   f.Printf(" @$(call echo,PREPECS = $(PREPECS))\n");
f.Printf(" @$(call echo,SYMBOLS = $(SYMBOLS))\n");
f.Printf(" @$(call echo,IMPORTS = $(IMPORTS))\n");
f.Printf(" @$(call echo,COBJECTS = $(COBJECTS))\n");


// if subdirs are used to store source files, the rule that maps source files
// to object files must be specified for each file. no static pattern rule is
// able to do this perfectly. see attempt(s) below.



//
// misc makefile stuff:
// #VPATH = ../extras/gui/controls ../extras ../extras/gui src/dialogs src/project src/designer src/debugger src/panels src/documents src
//
// # attempt at writing a static pattern rule for PREPS
// # filter could be problematic with files that end with same chars like: MyFile.ec and File.ec
// #$(PREPS): %$(P): $(filter %%.ec,$(SOURCES))
// #$(PREPS): %$(P): $(notdir %.ec)
// #$(PREPS): %$(P): %.ec
// # $(CPP) -x c -E $< -o $@