View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000740 | Ecere SDK | buildsystem | public | 2012-04-08 03:59 | 2016-08-20 19:45 |
Reporter | redj | Assigned To | redj | ||
Priority | immediate | Severity | feature | Reproducibility | N/A |
Status | assigned | Resolution | open | ||
Product Version | 0.44 Ryoan-ji | ||||
Target Version | 0.46 eC II | ||||
Summary | 0000740: improve makefile generation to include use static pattern rules | ||||
Description | make use of static pattern rules instead of printing every single rule | ||||
Tags | No tags attached. | ||||
|
VPATH and vpath are out since we can't be sure that the search order and matching by file name only will produce the correct match. a file in a different dir with the same name could cause trouble. |
|
re: $(TARGETS): %.c: $(filter %.ec,$(SOURCES)) instead of just $(TARGETS): %.c: %.ec these are out since the built-in function calls (i.e.: filter) are performed before any of the % patterns are expanded. |
|
here is what works: all the rules in the following section can be replaced by a single static pattern rule: # C OBJECT RULES $(OBJS_OF_C_FILE_FOR_EACH_EC_FILE): $(OBJ)%$(O): $(OBJ)%.c $(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $< -o $@ in the case of per-file arguments, something like: $(OBJS_OF_C_FILE_FOR_EACH_EC_FILE): $(OBJ)%$(O): $(OBJ)%.c $(CC) $(CFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $< -o $@ $(OBJS_OF_C_FILE_FOR_EACH_EC_FILE_ARGS_1): $(OBJ)%$(O): $(OBJ)%.c $(CC) $(CFLAGS) $(PRJ_CFLAGS_ARGS_1) $(FVISIBILITY) -c $< -o $@ that was the simple stuff now for source files that are in dirs for the rules of the following sections: # SYMBOL RULES $(SYMBOLS): $(OBJ)%.sym: $(srcdir)%.ec $(ECP) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) -c $< -o $@ $(SYMBOLS_FROM_DIR_A): $(OBJ)%.sym: $(srcdir)../dir/a/%.ec $(ECP) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) -c $< -o $@ # C OBJECT RULES $(TARGETS): $(OBJ)%.c: $(srcdir)%.ec $(ECC) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $< -o $@ -symbols $(OBJ) $(TARGETS_FROM_DIR_A_SRC): $(OBJ)%.c: $(srcdir)../dir/a/%.ec $(ECC) $(CFLAGS) $(CECFLAGS) $(ECFLAGS) $(PRJ_CFLAGS) $(FVISIBILITY) -c $< -o $@ -symbols $(OBJ) and those 4 static pattern rules would need to be multiplied by any applying per-file flags note that I have omitted some calls around the $< and $@ automatic variables for simplicity |
|
expected issues with these static pattern rules: I suspect that if $(targets) contains files with spaces in them, make will *not* be able to properly handle these files instead treating the spaces as list separator. and I don't think that quoting the files in these file lists will help but it's worth a try... quoting, escaping or both, etc... |
|
the messy stuff, which can mostly be disregarded, that was in the "additional information" field: // .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 $@ |
Date Modified | Username | Field | Change |
---|---|---|---|
2012-04-08 03:59 | redj | New Issue | |
2012-04-08 03:59 | redj | Status | new => assigned |
2012-04-08 03:59 | redj | Assigned To | => redj |
2012-04-08 12:29 | redj | Additional Information Updated | |
2013-04-24 20:25 | jerome | Assigned To | redj => |
2013-04-27 06:08 | redj | Status | assigned => new |
2016-04-19 05:29 | jerome | Target Version | 0.44.12 Fixes => 0.46 eC II |
2016-08-13 13:24 | redj | Assigned To | => redj |
2016-08-13 13:24 | redj | Status | new => assigned |
2016-08-20 19:26 | redj | Note Added: 0001438 | |
2016-08-20 19:28 | redj | Note Added: 0001439 | |
2016-08-20 19:40 | redj | Note Added: 0001440 | |
2016-08-20 19:41 | redj | Note Edited: 0001440 | |
2016-08-20 19:41 | redj | Note Edited: 0001440 | |
2016-08-20 19:43 | redj | Note Added: 0001441 | |
2016-08-20 19:45 | redj | Note Added: 0001442 | |
2016-08-20 19:45 | redj | Additional Information Updated | |
2016-08-20 19:45 | redj | Note Edited: 0001442 |