/* Copyright (C) 1993 Bell-Northern Research This file is part of vmkr. Vmkr is distributed in the hope that it will be useful, but without any warranty. No author or distributor accepts responsibility to anyone for the consequences of using it or for whether it serves any particular purpose or works at all, unless he says so in writing. Everyone is granted permission to copy, modify and redistribute vmkr, but only under the conditions described in the document "vmkr copying permission notice". An exact copy of the document is supposed to have been given to you along with vmkr so that you can know how you may redistribute it all. It should be in a file named COPYING. Among other things, the copyright notice and this notice must be preserved on all copies. */ #include "typedef.h" /* * Original Author : Himanshu M. Thaker * Description : * This file contains the routines that make the actual * makefile. */ /* include */ #include #include extern struct entity_struct *header_entity; extern struct arch_struct *header_arch; extern struct packages *header_package; extern struct config_struct *header_config; extern struct lib_names *header_lib; extern int return_code; extern int print_libs; extern int all_flag_set; extern int state_files_in_current_directory; extern int tool_set; /* * This package can be used to create the make file, based * on the dependencies created by makegen and its procedures. */ create_make() { struct arch_struct *tmp_arch; struct config_struct *tmp_config; struct packages *tmp_package; char *m2l(); char *ctime(); char *getcwd(); time_t clock; char token[MAXTOKEN], ename[MAXTOKEN], aname[MAXTOKEN], cname[MAXTOKEN]; int count; /* * Now, print out the make file... */ clock = time((long *)0); strcpy(token, ctime(&clock)); printf("# BNR vmkr version %s (%s)\n",VERSION, CREATE_DATE); printf("# Makefile generated on %s", token); strcpy(token, getcwd((char *)NULL, 128)); printf("# from directory '%s'\n#\n", token); build_libnames(); build_dependancies(); printf("\n# The update rules follow...\n\n"); build_packages(); build_entity_arch(); build_config(); /* * Print to stderr (just to inform the user, and NOT go * to stdout output), of all the possible top level ent-arch, * and top level configs he could build. * Added Aug 19/91 - hmt */ count = 0; fprintf(stderr, "\nThe possible top level architectures are :\n"); tmp_arch = header_arch; while (tmp_arch != NULL) { if (tmp_arch->entity != NULL) if (tmp_arch->entity->ports_exist != TRUE) { count++; fprintf(stderr, "\tsystem"); if (count !=1) fprintf(stderr, "%d",count); strcpy(ename, m2l(tmp_arch->ename)); strcpy(aname, m2l(tmp_arch->aname)); fprintf(stderr, "\t- maps to %s_%s\n",ename, aname); } tmp_arch = tmp_arch->next; } /* * now the top level configurations... */ tmp_config = header_config; fprintf(stderr, "\nThe possible top level configurations are :\n"); while (tmp_config != NULL) { if (tmp_config->entity != NULL) if (tmp_config->entity->ports_exist != TRUE) { count++; fprintf(stderr, "\tsystem"); if (count != 1) fprintf(stderr, "%d",count); strcpy(ename, m2l(tmp_config->ename)); strcpy(cname, m2l(tmp_config->cname)); fprintf(stderr, "\t- maps to %s_%s\n", cname, ename); } tmp_config = tmp_config->next; } } build_packages() { struct packages *tmp_package; char pname[MAXTOKEN], f_pname[MAXTOKEN], fpname[MAXTOKEN]; char tmp_token[MAXTOKEN]; char *m2l(); /* * Now, build all of the packages. */ tmp_package = header_package; while (tmp_package != NULL) { /* * modified code below on Feb. 19/92 - hmt * If a package body exists, but its corresponding package body * does, not, this is an error, and should be reported as such, * instead of core dumping... */ strcpy(pname, m2l(tmp_package->pname)); printf("#\n# for package '%s'\n#\n", pname); if (tmp_package->f_pname == NULL) { sprintf(tmp_token, "# ERROR : package missing for package body '%s'\n", pname); print_err(tmp_token); return_code = -1; } else { strcpy(f_pname, tmp_package->f_pname); printf("$(S)%s_.ana: %s\n",pname, f_pname); printf("\t$(VHDL) $(VHOPTS) %s\n",f_pname); printf("\t$(TOUCH)\n"); printf("$(S)%s_.mg: $(S)%s_.ana\n",pname,pname); printf("\t$(MG) $(MGOPTS) %s\n",pname); printf("\t$(TOUCH)\n"); } /* * end of modifications made on Feb. 19/92 */ /* * now, the package body, if it exists */ if (tmp_package->fpname == NULL) { printf("# note : no body for '%s'\n",pname); } else { printf("# now the body\n"); strcpy(fpname, tmp_package->fpname); /* * Note that if the package and package body reside in the same file, * we do not need to do a vhdl on the body also... */ if (tmp_package->f_pname == NULL) { printf("$(S)%s.ana: %s $(S)%s_.ana\n",pname, fpname, pname); printf("\t$(VHDL) $(VHOPTS) %s\n",fpname); } else { if (stringcmp(tmp_package->f_pname, tmp_package->fpname) == 0) { printf("$(S)%s.ana: $(S)%s_.ana\n",pname, pname); printf("# package and package body are in same VHDL file\n"); } else { printf("$(S)%s.ana: %s $(S)%s_.ana\n",pname, fpname, pname); printf("\t$(VHDL) $(VHOPTS) %s\n",fpname); } } printf("\t$(TOUCH)\n"); printf("$(S)%s.mg: $(S)%s.ana $(S)%s_.mg\n",pname, pname, pname); printf("\t$(MG) $(MGOPTS) -body %s\n",pname); printf("\t$(TOUCH)\n"); } tmp_package = tmp_package->next; } } char *m2l(s) char *s; { /* * This function takes as input a string, terminated by the null * character(same as what the string functions require), and return * the lowercase conversion of that string. */ int i; char result[MAXTOKEN]; i = 0; while (s[i] != '\0') { if (isupper(s[i])) { result[i] = tolower(s[i]); } else { result[i] = s[i]; } i++; } /* * copy the terminating null. */ result[i] = s[i]; return (result); } build_entity_arch() { /* * This procedure will walk through the architecture linked * list, and generate make commands to build the entity-arch pair. */ struct arch_struct *tmp_arch, *ttt_arch; char *m2l(); char aname[MAXTOKEN], faname[MAXTOKEN], f_ename[MAXTOKEN], ename[MAXTOKEN], cname[MAXTOKEN], e[MAXTOKEN], a[MAXTOKEN], tmp_token[MAXTOKEN]; int printed; int skip, found; /* * added variable tmp_entity below on Jan. 15/92, by hmt * This is to allow printing of code to make entities, even if * no architecture is supplied. */ struct entity_struct *tmp_entity, *ttt_entity; tmp_arch = header_arch; while (tmp_arch != NULL) { strcpy(aname, m2l(tmp_arch->aname)); strcpy(ename, m2l(tmp_arch->ename)); strcpy(faname, tmp_arch->faname); printf("#\n# for architecture '%s' of entity '%s'\n#\n", aname, ename); if (tmp_arch->entity == NULL) { sprintf(tmp_token, "# ERROR : file %s : architecture '%s' has no entity!\n", tmp_arch->faname, tmp_arch->aname); print_err(tmp_token); return_code = -1; } else { /* * check to see if the code to build the entity has been * printed yet. */ skip = FALSE; found = FALSE; if (tmp_arch->entity->built == TRUE) { printf("# code for making entity '%s' defined above\n", ename); skip = TRUE; } /* * now, search thru all of the architectures and entities to see * if the current entity resides in the same file as an entity or * architecture. If it resides in the same file, then the code * has already been generated to analyze this file. Thus, we should * make this analysis dependent on the analysis of the previous on * only. Added this on July 16/91 -- hmt. */ else { ttt_arch = header_arch; while ( (ttt_arch != NULL) && (ttt_arch != tmp_arch) && (!found) ) { /* * search until all of the architecture have been exhausted, or until * we come across this same architecture. Note that we don't need * the first test, but it is there just in case... */ if ( (stringcmp(ttt_arch->faname, tmp_arch->entity->f_ename) == 0) ) { /* * if this entity is from the same file as a previous architecture... */ found = TRUE; } else if (ttt_arch->entity != NULL) { if ( (stringcmp(ttt_arch->entity->f_ename, tmp_arch->entity->f_ename) == 0) ) /* * or if this entity is from the same file as a previous entity... */ found = TRUE; } if (!found) ttt_arch = ttt_arch->next; } } if (!skip) { /* * If not, then print the code for the entity... */ strcpy(f_ename, tmp_arch->entity->f_ename); tmp_arch->entity->built = TRUE; printf("# entity '%s'\n",ename); printed = FALSE; if (tmp_arch->config != NULL) { if (stringcmp(tmp_arch->config->fcname, f_ename) == 0) { strcpy(cname, m2l(tmp_arch->config->cname)); printf("$(S)%s_.ana: %s $(S)%s_%s.ana\n",ename, f_ename, cname, ename); printf("# entity '%s' is in the same file as ", ename); printf(" configuration '%s'\n",cname); printed = TRUE; } } else if (stringcmp(tmp_arch->faname, f_ename) == 0) { /* * if the entity is in the same file as the architecture, we shouldn't * analyze it here, but at the architecture... just print a message right * now. Added July 24/91 - hmt. */ printf("$(S)%s_.ana: %s\n",ename, f_ename); printf("# entity '%s' is in the same file as ", ename); printf(" architecture '%s'\n",aname); printed = TRUE; } if (!printed) { printf("$(S)%s_.ana: %s",ename, f_ename); if (!found) { printf("\n"); printf("\t$(VHDL) $(VHOPTS) %s\n",f_ename); } else { strcpy(a, m2l(ttt_arch->aname)); strcpy(e, m2l(ttt_arch->ename)); if (stringcmp(ttt_arch->faname, tmp_arch->entity->f_ename) == 0) { printf(" $(S)%s_%s.ana\n",e,a); printf("# entity '%s' in same file as architecture '%s(%s)'\n",ename, a, e); } else { printf(" $(S)%s_.ana\n",e); printf("# entity '%s' in same file as entity '%s'\n",ename, e); } } } printf("\t$(TOUCH)\n"); } } /* * now the make code for the architecture... */ printed = FALSE; printf("# architecture '%s'\n",aname); /* * first check to see if the architecture is in the same file as * its configuration (if it exists) */ if (tmp_arch->config != NULL) if (stringcmp(tmp_arch->config->fcname, tmp_arch->faname) == 0) { strcpy(cname, m2l(tmp_arch->config->cname)); printf("$(S)%s_%s.ana: %s $(S)%s_%s.ana\n", ename, aname, faname, cname, ename); printf("# architecture '%s' is in the same file as", aname); printf(" configuration '%s'\n",cname); printed = TRUE; } /* * commented this out Jul 24/91 - hmt * if the architecture is in the same file as the entity, then * we should do the analysis (vhdl) when we want to update the architecture if (!printed) if (tmp_arch->entity != NULL) if (stringcmp(tmp_arch->entity->f_ename, tmp_arch->faname) == 0) { * If the architecture is in the same file as the entity, * then make the arch dependent on the entity being vhdl'd printf("$(S)%s_%s.ana: %s $(S)%s_.ana\n", ename, aname, faname, ename); printf("# architecture '%s' is in the same file as", aname); printf(" entity '%s'\n",tmp_arch->ename); printed = TRUE; } * end of commented out stuff Jul 24/91 - hmt */ if (printed == FALSE) { /* * If the architecture is not in the same file as the entity or configuration * we can vhdl it. */ printf("$(S)%s_%s.ana: %s $(S)%s_.ana\n", ename, aname, faname, ename); printf("\t$(VHDL) $(VHOPTS) %s\n",faname); } printf("\t$(TOUCH)\n"); /* * now, the code to mg the architecture */ printf("$(S)%s_%s.mg: $(S)%s_%s.ana\n",ename, aname, ename, aname); printf("\t$(MG) $(MGOPTS) "); if (tmp_arch->entity != NULL) if (tmp_arch->entity->ports_exist == FALSE) { /* * If there are no ports in the entity, then this this architecture * is a top level arch. */ printf("-top "); } printf("'%s(%s)'\n", ename, aname); printf("\t$(TOUCH)\n"); if (tmp_arch->entity != NULL) if (tmp_arch->entity->ports_exist == FALSE) { /* * also, if this is a top level arch, then we should build it. */ printf("$(S)%s_%s.bd: $(S)%s_%s.mg\n", ename, aname, ename, aname); printf("\t$(BD) -replace $(BDOPTS) '%s(%s)'\n", ename, aname); printf("\t$(TOUCH)\n"); } tmp_arch = tmp_arch->next; } /* * code to make loose entities (ie. those that have no architecture * provided) added on Jan. 15/92 by hmt. */ tmp_entity = header_entity; while (tmp_entity != NULL) { if (tmp_entity->built == FALSE) { /* * Now, search thru all of the entities to see if the current entity * resides in the same file as another entity. If it does, then the code * has already been generated to analyze this file. Thus, we should * make this analysis dependent on the analysis of the previous on * only. */ ttt_entity = header_entity; found = FALSE; while ( (ttt_entity != NULL) && (ttt_entity != tmp_entity) && (!found) ) { if ( (stringcmp(ttt_entity->f_ename, tmp_entity->f_ename) == 0) ) { /* * if this entity is from the same file as a previous entity... */ found = TRUE; } if (!found) ttt_entity = ttt_entity->next; } strcpy(f_ename, tmp_entity->f_ename); strcpy(ename, m2l(tmp_entity->ename)); tmp_entity->built = TRUE; printf("# entity '%s'\n",ename); printf("$(S)%s_.ana: %s",ename, f_ename); if (!found) { printf("\n"); printf("\t$(VHDL) $(VHOPTS) %s\n",f_ename); } else { strcpy(a, m2l(ttt_arch->aname)); strcpy(e, m2l(ttt_arch->ename)); printf(" $(S)%s_.ana\n",e); printf("# entity '%s' in same file as entity '%s'\n",ename, e); } printf("\t$(TOUCH)\n"); } tmp_entity = tmp_entity->next; } } build_config() { struct config_struct *tmp_config; char *m2l(); char aname[MAXTOKEN], fcname[MAXTOKEN], ename[MAXTOKEN], cname[MAXTOKEN], tmp_token[MAXTOKEN]; int file_same; int printed; tmp_config = header_config; while (tmp_config != NULL) { strcpy(ename, m2l(tmp_config->ename)); strcpy(cname, m2l(tmp_config->cname)); strcpy(fcname, tmp_config->fcname); strcpy(aname, ""); if (tmp_config->aname != NULL) strcpy(aname, m2l(tmp_config->aname)); /* * for this configuration, first generate the code to analyse * the source file */ printf("#\n# for configuration '%s' of entity '%s'\n#\n", cname, ename); file_same = FALSE; printf("$(S)%s_%s.ana: %s $(S)%s_%s.ana ",cname, ename, fcname, ename, aname); /* * If the configuration is in the same file as the architecture or entity, * it must wait for them to be resolved first. if (tmp_config->arch != NULL) if (strcmp(fcname, tmp_config->arch->faname) == 0) { file_same = TRUE; printf("$(S)%s_%s.ana ", ename, aname); } */ if (tmp_config->entity != NULL) if (strcmp(fcname, tmp_config->entity->f_ename) == 0) { printf("$(S)%s_.ana", ename); file_same = TRUE; } printf("\n"); printf("\t$(VHDL) $(VHOPTS) %s\n", fcname); printf("\t$(TOUCH)\n"); printed = FALSE; if (tmp_config->entity == NULL) { sprintf(tmp_token, "# ERROR : file %s : no entity declaration for config %s\n", tmp_config->fcname, cname); print_err(tmp_token); sprintf(tmp_token, "# of entity '%s'\n",ename); print_err(tmp_token); return_code = -1; } else { printf("$(S)%s_%s.mg: $(S)%s_%s.ana\n", cname, ename, cname, ename); printf("\t$(MG) $(MGOPTS)"); /* * configurations who's entities have no ports can only have the -top option... * all others cannot... * added Sept. 13/91 - hmt. */ if (tmp_config->entity->ports_exist == FALSE) printf(" -top"); printf(" %s\n",cname); printf("\t$(TOUCH)\n"); if (tmp_config->entity->ports_exist == FALSE) { /* * Note that if this config file's entity has no ports, then this * config can be built. */ printf("$(S)%s_%s.bd: $(S)%s_%s.mg\n", cname, ename, cname, ename); printf("\t$(BD) -replace $(BDOPTS) %s\n", cname); printf("\t$(TOUCH)\n"); } printed = TRUE; } tmp_config = tmp_config->next; if (!printed) { /* * If the configuration is not a top level configuration, then the * code to mg it was not printed above. */ printf("$(S)%s_%s.mg: $(S)%s_%s.ana\n", cname, ename, cname, ename); printf("\t$(MG) $(MGOPTS) %s\n", cname); printf("\t$(TOUCH)\n"); } } } build_dependancies() { struct arch_struct *tmp_arch; struct config_struct *tmp_config; struct packages *tmp_package; char *m2l(); char aname[MAXTOKEN], fcname[MAXTOKEN], pname[MAXTOKEN], ename[MAXTOKEN], cname[MAXTOKEN]; char print_string[MAXTOKEN]; int top_level_count; int count; int printed; int i; /* * Added tmp_entity, to go thru loose entities, Jan. 15/92 - hmt */ struct entity_struct *tmp_entity; int found; top_level_count = 0; /* * by default, if the user specifies make with no options, the very * first system is made. */ printf("system:\n"); /* * added the following target, Feb. 5/92 - hmt. * This allows the user to just analyze (vhdl for intermetrics) any * of the files entered, without having to mg, build, etc. */ count = 0; sprintf(print_string, "analyze: "); count = print_nice(print_string, count); tmp_arch = header_arch; while (tmp_arch != NULL) { strcpy(aname, m2l(tmp_arch->aname)); strcpy(ename, m2l(tmp_arch->ename)); sprintf(print_string,"$(S)%s_%s.ana ", ename, aname); count = print_nice(print_string, count); tmp_arch = tmp_arch->next; } tmp_entity = header_entity; while (tmp_entity != NULL) { strcpy(ename, m2l(tmp_entity->ename)); sprintf(print_string,"$(S)%s_.ana ",ename); count = print_nice(print_string, count); tmp_entity = tmp_entity->next; } tmp_package = header_package; while (tmp_package != NULL) { strcpy(pname, m2l(tmp_package->pname)); if (tmp_package->f_pname != NULL) { sprintf(print_string, "$(S)%s_.ana ", pname); count = print_nice(print_string, count); } if (tmp_package->fpname != NULL) { sprintf(print_string, "$(S)%s.ana ", pname); count = print_nice(print_string, count); } tmp_package = tmp_package->next; } tmp_config = header_config; while (tmp_config != NULL) { strcpy(cname, m2l(tmp_config->cname)); strcpy(ename, m2l(tmp_config->ename)); sprintf(print_string,"$(S)%s_%s.ana ", cname, ename); count = print_nice(print_string, count); tmp_config = tmp_config->next; } sprintf(print_string, "\n"); count = print_nice(print_string, count); /* * end of stuff entered on Feb. 5/92 */ /* * First, for all of the packages, print their dependencies on other * packages. */ printf("\n"); printf("#\n# The package dependencies on other packages follow\n"); tmp_package = header_package; while (tmp_package != NULL) { build_package_package(tmp_package); tmp_package = tmp_package->next; } tmp_arch = header_arch; printf("\n#\n# The entity-architecture dependencies on packages follow\n"); while (tmp_arch != NULL) { /* * For all the architectures, build the relational * between architectures and entites to packages. */ build_arch_entity_package(tmp_arch); tmp_arch = tmp_arch->next; } printf("\n#\n# Top level architecture dependencies on other\n"); printf("# arch/entity or config follow\n#\n"); tmp_arch = header_arch; while (tmp_arch != NULL) { if (tmp_arch->entity != NULL) if (tmp_arch->entity->ports_exist != TRUE) { /* * for all top level architectures (ie. those whose entities have * no ports), print out their dependencies on other architectures * or configurations. */ top_level_count++; strcpy(aname, m2l(tmp_arch->aname)); strcpy(ename, m2l(tmp_arch->ename)); strcpy(cname, ""); build_bind(tmp_arch->bind, aname, ename, cname, 1); build_bd(tmp_arch, NULL, tmp_arch->bind, aname, ename, cname); /* * now we must clear, in all packages, the boolean 'printed', as * we used it to build dependencies on package bodies (in procedure * 'check_package_body()'). Another top level could depend on those * packages also. */ tmp_package = header_package; while (tmp_package != NULL) { tmp_package->printed = FALSE; tmp_package = tmp_package->next; } /* * if this is the first top level, then it is called "system". * All others are called "systemi" where i varies from 2 to whatever... */ printf("\n"); if (top_level_count == 1) { printf("system: "); } else { printf("system%d: ", top_level_count); } printf("$(S)%s_%s.bd\n", ename, aname); /* * map the system to _ so that the user * can specify this, instead of determining what the mappings are. * Added Aug 19/91 - hmt */ printf("%s_%s: system",ename, aname); if (top_level_count == 1) printf("\n"); else printf("%d\n",top_level_count); printf("\n"); /* * add target to makefile, to allow simulation. * Added Nov. 18/91 - hmt */ if (top_level_count == 1) { printf("sim: system\n"); } else { printf("sim%d: system%d\n", top_level_count, top_level_count); } printf("\t$(SIM) $(SIM_OPTS) %s\n",aname); printf("# --------------\n"); tmp_arch->used_by_toplevel = TRUE; } tmp_arch = tmp_arch->next; } /* * Now, go through all of the top level configurations. */ printf("\n#\n# Top level configuration dependencies on other\n"); printf("# arch/entity or config follow\n#\n"); tmp_config = header_config; while (tmp_config != NULL) { if (tmp_config->entity != NULL) if (tmp_config->entity->ports_exist != TRUE) { top_level_count++; strcpy(aname, ""); strcpy(ename, m2l(tmp_config->ename)); strcpy(cname, m2l(tmp_config->cname)); build_bind(tmp_config->bind, aname, ename, cname, 1); build_bd(NULL, tmp_config, tmp_config->bind, aname, ename, cname); /* * moved line below from build_bd, as part of changes of Sept. 13/91, to here. */ printf("$(S)%s_%s.bd: $(S)%s_%s.mg\n", cname, ename, cname, ename); /* * like above, we must clear the 'printed' boolean variable. */ tmp_package = header_package; while (tmp_package != NULL) { tmp_package->printed = FALSE; tmp_package = tmp_package->next; } /* * if this is the first top level, then it is called "system". * All others are called "systemi" where i varies from 2 to whatever... */ printf("\n"); if (top_level_count == 1) { printf("system: "); } else { printf("system%d: ", top_level_count); } printf("$(S)%s_%s.bd\n", cname, ename); /* * map the system to _ so that the user * can specify this, instead of determining what the mappings are. * Added Aug 19/91 - hmt */ printf("%s_%s: system",cname, ename); if (top_level_count == 1) printf("\n"); else printf("%d\n",top_level_count); printf("\n"); /* * add target to makefile, to allow simulation. * Added Nov. 18/91 - hmt */ if (top_level_count == 1) { printf("sim: system\n"); } else { printf("sim%d: system%d\n", top_level_count, top_level_count); } printf("\t$(SIM) $(SIM_OPTS) %s\n\n",cname); printf("# --------------\n"); } tmp_config = tmp_config->next; } /* * 'make all' should make ALL of the systems. * Added Aug 19/91 - hmt */ printf("#\n# Type 'make all' to make ALL of the systems\n"); if (top_level_count == 0) printf("# Here, 'make all' makes the loose units\n"); printf("all: "); count = 5; for (i=1; i<= top_level_count; i++) { if (i == 1) sprintf(print_string, "system "); else sprintf(print_string, "system%d ", i); count = print_nice(print_string, count); } /* * 'make all' should now make the loose stuff, if NO systems * were found. Added Sept. 24/91 - hmt */ if (top_level_count == 0) { sprintf(print_string, "loose "); count = print_nice(print_string, count); } printf("\n"); /* * Finally, go thru all of the architectures, and for all of the ones that * are loose (ie. not used by a top level architectures)... */ /* * Check to see if the user wants to print out all of the loose * entity/architecture pairs, and packages. If it is set, then we must create * a target called loose, that when make'd, will make all of the loose * entity-architectures (the ones not used by the top level). */ if (all_flag_set) { printf("\n#\n# Type 'make loose' to make the loose entity-\n"); printf("# architectures, entities, and packages.\n"); printf("loose : .loose_arch .loose_entity .loose_package\n"); } tmp_arch = header_arch; printed = FALSE; count = 13; if (all_flag_set) { printf("\n#\n# Loose entity-architectures, entities, and packages follow\n#\n"); while (tmp_arch != NULL) { if (!tmp_arch->used_by_toplevel) { strcpy(aname, m2l(tmp_arch->aname)); strcpy(ename, m2l(tmp_arch->ename)); strcpy(cname, ""); build_bind(tmp_arch->bind, aname, ename, cname, 0); } tmp_arch = tmp_arch->next; } tmp_arch = header_arch; printed = FALSE; count = 13; while (tmp_arch != NULL) { if (!tmp_arch->used_by_toplevel) { /* * if this architecture has not been used by any top level architecture, * print out the dependency. */ if (!printed) { printf(".loose_arch: "); printed = TRUE; } strcpy(aname, m2l(tmp_arch->aname)); strcpy(ename, m2l(tmp_arch->ename)); sprintf(print_string, "$(S)%s_%s.mg ", ename, aname); count = print_nice(print_string, count); tmp_arch->used_by_toplevel = TRUE; } /* * added code to mark all entities that have a least one architecture * as not loose, in the sense that there is an associated architecture. * Added Jan. 15/92 - hmt. */ if (tmp_arch->entity != NULL) { if (tmp_arch->entity->loose == TRUE) tmp_arch->entity->loose = FALSE; } tmp_arch = tmp_arch->next; } if (!printed) printf(".loose_arch: \n"); else printf("\n"); } /* * now, do this for loose entities. Added Jan. 15/92 - hmt. */ if (all_flag_set) { printed = FALSE; count = 14; tmp_entity = header_entity; while (tmp_entity != NULL) { if (tmp_entity->loose == TRUE) { if (!printed) { printf(".loose_entity: "); printed = TRUE; } strcpy(ename, m2l(tmp_entity->ename)); sprintf(print_string, "$(S)%s_.ana ", ename); count = print_nice(print_string, count); } tmp_entity = tmp_entity->next; } if (!printed) printf(".loose_entity: \n"); else printf("\n"); } /* * now do the same for packages. */ tmp_package = header_package; printed = FALSE; count = 16; if (all_flag_set) { while (tmp_package != NULL) { if (!tmp_package->used_by_toplevel) { if (!printed) { printf(".loose_package: "); printed = TRUE; } strcpy(pname, m2l(tmp_package->pname)); /* * check to see if the package has a body... if so, make * the dependency onto the package body being mg'd. * If not, make the dependency on the package being mg'd. */ if (tmp_package->fpname != NULL) { sprintf(print_string, "$(S)%s.mg ", pname); count = print_nice(print_string, count); } else { sprintf(print_string, "$(S)%s_.mg ", pname); count = print_nice(print_string, count); } tmp_package->used_by_toplevel = TRUE; } tmp_package = tmp_package->next; } if (!printed) printf(".loose_package: \n"); else printf("\n"); } } build_package_package(package) struct packages *package; { /* * this procedure prints out package dependencies on other packages. */ char pname[MAXTOKEN], pkg_name[MAXTOKEN]; struct package_ptrs *pkg_ptr; int body; strcpy(pname, m2l(package->pname)); if (package->pkg != NULL) { body = 0; printf("#\n# for package %s\n",pname); pkg_ptr = package->pkg; while (pkg_ptr != NULL) { /* * for all of the use package clauses, print out the dependencies. * They are : the analysis of the package depends on the analysis of * the packages it uses. Additionally, the model generation of the * package depends on the model generation of the package it uses. */ print_package(pkg_ptr, pname, body, package->f_pname); pkg_ptr = pkg_ptr->next; } } if (package->pkg_body != NULL) { body = 1; printf("#\n# for package body %s\n",pname); pkg_ptr = package->pkg_body; while (pkg_ptr != NULL) { /* * for all of the use package clauses, print out the dependencies. * They are : the analysis of the package body depends on the analysis of * the packages it uses. Additionally, the model generation of the * package body depends on the model generation of the packages it uses. */ print_package(pkg_ptr, pname, body, package->fpname); pkg_ptr = pkg_ptr->next; } } } build_arch_entity_package(arch) struct arch_struct *arch; { char aname[MAXTOKEN], ename[MAXTOKEN]; char pname[MAXTOKEN], libname[MAXTOKEN], tmp_token[MAXTOKEN]; struct arch_struct *tmp_arch; struct entity_struct *tmp_entity; struct packages *tmp_package; struct package_ptrs *tmp_use, *tmp_use2; char *m2l(); int found; tmp_arch = arch; strcpy(aname, m2l(tmp_arch->aname)); strcpy(ename, m2l(tmp_arch->ename)); printf("#\n# for architecture '%s' of entity '%s'\n",aname, ename); if (tmp_arch->entity != NULL) { tmp_use = tmp_arch->entity->pkg; /* * now print out the code to make the dependencies. */ tmp_use = tmp_arch->entity->pkg; while (tmp_use != NULL) { strcpy(pname, m2l(tmp_use->pname)); tmp_package = tmp_use->pkg_ptr; if (tmp_use->libname == NULL) { /* * if we had work.xxx... */ if (tmp_package == NULL) { sprintf(tmp_token,"# ERROR : file %s : package '%s' has not been parsed.\n", tmp_arch->faname, tmp_use->pname); print_err(tmp_token); return_code = -1; } else { if (tmp_arch->entity->packaged != TRUE) { printf("$(S)%s_.ana: $(S)%s_.ana\n", ename, pname); } printf("$(S)%s_%s.mg: $(S)%s_.mg\n", ename, aname, pname); } } else if ( (print_libs == TRUE) || (tmp_package != NULL) ) { /* * even if the package is not from Work, and it is not in the * If the print_libs flag is set, OR the package is in the working * directory, then we print out the dependency info. */ strcpy(libname, m2l(tmp_use->libname)); if (tmp_arch->entity->packaged != TRUE) { printf("$(S)%s_.ana: $(%s)$(S)%s_.ana\n", ename, libname, pname); } printf("$(S)%s_%s.mg: $(%s)$(S)%s_.mg\n", ename, aname, libname, pname); } tmp_use = tmp_use->next; } if (tmp_arch->entity->packaged != TRUE) { tmp_arch->entity->packaged = TRUE; } else { printf("# entity '%s' package dependencies previously printed\n", ename); } } /* * Now, the architecture use files... note that we only create * dependencies if they did not exist in the corresponding entity * use files. */ tmp_use = tmp_arch->pkg; while (tmp_use != NULL) { strcpy(pname, m2l(tmp_use->pname)); tmp_package = tmp_use->pkg_ptr; /* * Now, search thru the entity package linked list to see if * there is a match on the name... if there isn't, then the * architecture is dependent on this package. */ found = FALSE; tmp_use2 = NULL; if (tmp_arch->entity != NULL) tmp_use2 = tmp_arch->entity->pkg; while ( (!found) && (tmp_use2 != NULL) ) { if (stringcmp(tmp_use2->pname, tmp_use->pname) == 0) { found = TRUE; } tmp_use2 = tmp_use2->next; } if (found == FALSE) { if (tmp_use->libname == NULL) { /* * if we had work.xxx */ if (tmp_use->pkg_ptr == NULL) { sprintf(tmp_token,"# ERROR : file %s : package '%s' has not been parsed.\n", tmp_arch->faname, pname); print_err(tmp_token); return_code = -1; } else { printf("$(S)%s_%s.ana: $(S)%s_.ana\n", ename, aname, pname); printf("$(S)%s_%s.mg: $(S)%s_.mg\n", ename, aname, pname); } } else if ( (print_libs == TRUE) || (tmp_package != NULL) ) { /* * otherwise, if the print_lib flag is set, or the package exists in the * current directory... */ strcpy(libname, m2l(tmp_use->libname)); printf("$(S)%s_%s.ana: $(%s)$(S)%s_.ana\n", ename, aname, libname, pname); printf("$(S)%s_%s.mg: $(%s)$(S)%s_.mg\n", ename, aname, libname, pname); } } tmp_use = tmp_use->next; } } print_package(pkg_ptr, p, body, fname) struct package_ptrs *pkg_ptr; char *p; int body; char *fname; { /* * this procedure will print out the package name that the * calling routine's package, architecture, or entity depends on. */ struct package_ptrs *tmp_use; char pname[MAXTOKEN], libname[MAXTOKEN], tmp_token[MAXTOKEN]; tmp_use = pkg_ptr; strcpy(pname, m2l(tmp_use->pname)); if (tmp_use->libname == NULL) { /* * if we had work.xxx... */ if (tmp_use->pkg_ptr == NULL) { sprintf(tmp_token, "# ERROR : file %s : package '%s' has not been parsed.\n", fname, pname); print_err(tmp_token); return_code = -1; } else { if (body) printf("$(S)%s.ana: ", p); else printf("$(S)%s_.ana: ", p); printf("$(S)%s_.ana\n", pname); if (body) printf("$(S)%s.mg: ", p); else printf("$(S)%s_.mg: ", p); printf("$(S)%s_.mg\n", pname); } } else if ( (print_libs == TRUE) || (tmp_use->pkg_ptr != NULL) ) { /* * If the print_libs flag is set, OR the package is in the working * directory, then we print out the dependency info. */ strcpy(libname, m2l(tmp_use->libname)); if (body) printf("$(S)%s.ana: ", p); else printf("$(S)%s_.ana: ", p); printf("$(%s)$(S)%s_.ana\n", libname, pname); if (body) printf("$(S)%s.mg: ", p); else printf("$(S)%s_.mg: ", p); printf("$(%s)$(S)%s_.mg\n", libname, pname); } } build_bind(bind, aname, ename, cname, type) struct binding_struct *bind; char *aname, *ename, *cname; int type; { /* * This sub program takes as input a pointer to a record * of type bind. * It will search thru the linked list structure and print out * the arch-entity, or config that the calling arch depends on. * It will then, for every bind structure, call this sub program * recursively. */ struct binding_struct *tmp_bind; int count; char *m2l(); char e[MAXTOKEN]; char a[MAXTOKEN], c[MAXTOKEN]; char print_string[MAXTOKEN]; char libname[MAXTOKEN]; count = 0; tmp_bind = bind; /* * If there is at least one dependency... */ if (tmp_bind != NULL) { if (stringcmp(aname, "") != 0) { /* * if the arch name is not null, then the caller was an arch * entity pair. */ printf("$(S)%s_%s.ana: ", ename, aname); count = count + strlen(ename) + strlen(aname) + 7; } else { /* * otherwise, the caller was a config. */ printf("$(S)%s_%s.ana: ", cname, ename); count = count + strlen(cname) + strlen(ename) + 7; } } while (tmp_bind != NULL) { /* * for all of the dependencies, if the config name is not null, * then this bind structure indicates that the calling arch * depends on the config this bind points to. */ /*----printf("note that tmp_bind ename aname cname is '%s' '%s' '%s'\n",tmp_bind->ename, tmp_bind->aname, tmp_bind->cname);*/ strcpy(e, ""); if (tmp_bind->cname != NULL) { strcpy(c, m2l(tmp_bind->cname)); if (tmp_bind->config != NULL) { /* * check to see if we should print an error message. * This occurs if the library is "work", and we haven't parsed the * entity name. */ if (tmp_bind->config->ename == NULL) { if (tmp_bind->work == TRUE) { printf(print_string, "\\\n# ERROR : file %s : entity name not defined for config '%s'\n\t", tmp_bind->config->fcname, tmp_bind->cname); print_err(print_string); return_code = -1; } } else strcpy(e, m2l(tmp_bind->config->ename)); } if (tmp_bind->libname == NULL) { sprintf(print_string, "$(S)%s_%s.ana ", c, e); count = print_nice(print_string, count); } else if ( (print_libs == TRUE) || (tmp_bind->config != NULL) ) { strcpy(libname, m2l(tmp_bind->libname)); sprintf(print_string, "$(%s)$(S)%s_%s.ana ", libname, c, e); count = print_nice(print_string, count); } } else { /* * if the config name is null, it implies that the bind structure * indicates that the calling arch depends on the entity-arch that this * bind points to. * * Now, check to see if the entity was parsed. Note that if the library * is "work", and the entity was not parsed, then print an error. If the * library is not "work" and if the entity was parsed (ie in this directory), then * we should print the dependency. */ if (tmp_bind->work == TRUE) { if (tmp_bind->entity == NULL) { sprintf(print_string,"\\\n# WARNING : no entity %s found\n\t", tmp_bind->ename); print_err(print_string); strcpy(e, ""); return_code = -1; } else strcpy(e, m2l(tmp_bind->ename)); } else strcpy(e, m2l(tmp_bind->ename)); strcpy(a, m2l(tmp_bind->aname)); if (tmp_bind->libname == NULL) { /* * note : changed May 30/91 by hmt * change : * an architecture depends only on the entity of the ent-arch pair * it depends on, being vhdl'd, and NOT the architecture. * old code : * sprintf(print_string, "$(S)%s_%s.ana ", e, a); */ /* * modified Sept. 13/91 by hmt * change : * a configuration depends on the architecture being vhdl'd... * old code : sprintf(print_string, "$(S)%s_.ana ", e); */ /* * modifed Feb. 4/93 by hmt * change : * For synopsys toolset, they require that the architecure depends on * the ent-arch pair. */ if (tool_set == SYNOPSYS) { sprintf(print_string, "$(S)%s_%s.ana ", e, a); } else { if (stringcmp(aname, "") == 0) sprintf(print_string, "$(S)%s_%s.ana ", e, a); else sprintf(print_string, "$(S)%s_.ana ", e); } count = print_nice(print_string, count); /* * flag to indicate that this architecture is used by at least one top level * architecture, so that it is easy to find the top level architectures that * are not used. */ if ( (tmp_bind->arch != NULL) && (type != 0) ) tmp_bind->arch->used_by_toplevel = TRUE; } else if ( (print_libs == TRUE) || (tmp_bind->arch != NULL) ) { strcpy(libname, m2l(tmp_bind->libname)); /* * same change as above for May 30/91 by hmt * old code : * sprintf(print_string, "$(%s)$(S)%s_%s.ana ", libname, e, a); */ /* * modified Sept. 13/91 by hmt * change : * a configuration depends on the architecture being vhdl'd... * old code : sprintf(print_string, "$(%s)$(S)%s_.ana ", libname, e); */ if (stringcmp(aname, "") == 0) sprintf(print_string, "$(%s)$(S)%s_%s.ana ", libname, e, a); else sprintf(print_string, "$(%s)$(S)%s_.ana ", libname, e); count = print_nice(print_string, count); /* * flag to indicate that this arch is used by at least one top level, * same as code above... */ if ( (tmp_bind->arch != NULL) && (type != 0) ) tmp_bind->arch->used_by_toplevel = TRUE; } } tmp_bind = tmp_bind->next; if (tmp_bind == NULL) printf("\n"); } /* * Now, we must do a recursive search for all of the bind structures * in this linked list. */ tmp_bind = bind; while (tmp_bind != NULL) { if (tmp_bind->arch != NULL) { /* * if this bind structure's arch is not null, then it depends on * an entity-arch pair. Get the entity and arch name, as well as * the entity-arch's bind pointer, and do a search for all of the * binds that they depend on. */ strcpy(a, m2l(tmp_bind->arch->aname)); strcpy(e, m2l(tmp_bind->arch->ename)); strcpy(c, ""); build_bind(tmp_bind->arch->bind, a, e, c, type); } else if (tmp_bind->config != NULL) { /* * otherwise, this bind depends on the config */ strcpy(a, ""); strcpy(e, m2l(tmp_bind->config->ename)); strcpy(c, m2l(tmp_bind->config->cname)); build_bind(tmp_bind->config->bind, a, e, c, type); } tmp_bind = tmp_bind->next; } } build_bd(arch, config, bind, aname, ename, cname) struct arch_struct *arch; struct config_struct *config; struct binding_struct *bind; char *aname, *ename, *cname; { /* * this sub procedure will print out all of the dependencies from * the root given, on .mg files. */ struct binding_struct *tmp_bind; int count; char a[MAXTOKEN]; char e[MAXTOKEN]; char c[MAXTOKEN]; count = 0; tmp_bind = bind; if (stringcmp(aname, "") != 0) { /* * If the calling routine is printing bd files for architectures... */ printf("$(S)%s_%s.bd: $(S)%s_%s.mg ", ename, aname, ename, aname); count = count + 14 + 2*strlen(ename) + 2*strlen(aname); } else { /* * otherwise, the calling routine is for configurations... * Note that we must make the config mg file dependent on all the other * mg files, and then make the .bd file dependent on this .mg file. */ printf("$(S)%s_%s.mg: $(S)%s_", cname, ename, ename); count = count + 9 + strlen(cname) + 2*strlen(ename); if (config->arch != NULL) { strcpy(a, m2l(config->arch->aname)); printf("%s.mg ", a); count = count + 4 + strlen(a); } } if (arch != NULL) { if (arch->entity != NULL) count = check_package_body(arch->entity->pkg, count); count = check_package_body(arch->pkg, count); } count = print_bd(tmp_bind, count); printf("\n"); /* * as part of changes on Sept 13/91, the following * was moved to the main calling routine, just for configurations... if (config != NULL) { printf("$(S)%s_%s.bd: $(S)%s_%s.mg\n", cname, ename, cname, ename); } */ /* * added the code below Sept. 13/91 - hmt * Needed in order to satisfy rule that before a configuration can be * model generated, all its dependencies must be model generated, AND * all the configurations it depends on must also follow the same rule.... */ if (config != NULL) { tmp_bind = config->bind; while (tmp_bind != NULL) { if (tmp_bind->config != NULL) { strcpy(a, ""); strcpy(e, m2l(tmp_bind->config->ename)); strcpy(c, m2l(tmp_bind->config->cname)); build_bd(NULL, tmp_bind->config, tmp_bind->config->bind, a, e, c); } tmp_bind = tmp_bind->next; } } /* end of stuff added on Sept 13/91 */ } print_bd(bind, count_in) struct binding_struct *bind; int count_in; { struct binding_struct *tmp_bind; char c[MAXTOKEN], e[MAXTOKEN], a[MAXTOKEN]; char print_string[MAXTOKEN], libname[MAXTOKEN]; char *m2l(); int count; count = count_in; tmp_bind = bind; while (tmp_bind != NULL) { if (tmp_bind->cname != NULL) { /* * if the top level arch or config depends on this config (directly, * or indirectly), it then depends on its .mg file */ strcpy(e, ""); strcpy(c, m2l(tmp_bind->cname)); if (tmp_bind->config != NULL) if (tmp_bind->config->ename == NULL) { if (tmp_bind->work == TRUE) { sprintf(print_string, "\\\n# ERROR : entity name not defined for config '%s'\n\t", tmp_bind->cname); print_err(print_string); return_code = -1; } } else strcpy(e, m2l(tmp_bind->config->ename)); if (tmp_bind->libname == NULL) { sprintf(print_string, "$(S)%s_%s.mg ",c, e); count = print_nice(print_string, count); } else if ( (print_libs == TRUE) || (tmp_bind->config != NULL) ) { strcpy(libname, m2l(tmp_bind->libname)); sprintf(print_string, "$(%s)$(S)%s_%s.mg ",libname,c, e); count = print_nice(print_string, count); } /* * Now, walk through all of the packages for the entity and arch * pointed to in the config. */ if (tmp_bind->config != NULL) { if (tmp_bind->config->entity != NULL) { count = check_package_body(tmp_bind->config->entity->pkg, count); } else if (tmp_bind->config->arch != NULL) { count = check_package_body(tmp_bind->config->arch->pkg, count); } } } else { /* * if there isn't a config dependency, then there is an * arch/entity pair dependency */ if (tmp_bind->aname == NULL) { strcpy(a, ""); } else strcpy(a, m2l(tmp_bind->aname)); if (tmp_bind->ename == NULL) { strcpy(e, ""); } else strcpy(e, m2l(tmp_bind->ename)); if (tmp_bind->libname == NULL) { sprintf(print_string, "$(S)%s_%s.mg ", e, a); count = print_nice(print_string, count); } else if ( (print_libs == TRUE) || (tmp_bind->arch != NULL) ) { strcpy(libname, m2l(tmp_bind->libname)); sprintf(print_string, "$(%s)$(S)%s_%s.mg ",libname, e, a); count = print_nice(print_string, count); } /* * now, search thru all of the packages, first for the entity, * and then for the architecture, to see if we should add any package * body .mg files to the dependency list. */ if (tmp_bind->entity != NULL) count = check_package_body(tmp_bind->entity->pkg, count); if (tmp_bind->arch != NULL) count = check_package_body(tmp_bind->arch->pkg, count); } tmp_bind = tmp_bind->next; } tmp_bind = bind; while (tmp_bind != NULL) { if (tmp_bind->config != NULL) { count = print_bd(tmp_bind->config->bind, count); } else if (tmp_bind->arch != NULL) { count = print_bd(tmp_bind->arch->bind, count); } tmp_bind = tmp_bind->next; } return(count); } check_package_body(pkg, count_in) struct package_ptrs *pkg; int count_in; { struct package_ptrs *tmp_use; char p[MAXTOKEN]; char print_string[MAXTOKEN], libname[MAXTOKEN]; char *m2l(); int count; count = count_in; tmp_use = pkg; while (tmp_use != NULL) { if ( (tmp_use->pkg_ptr == NULL) && (tmp_use->work == TRUE) ) { sprintf(print_string, "\\\n# WARNING : package '%s' not parsed\n\t", tmp_use->pname); print_err(print_string); return_code = -1; } else if ( (tmp_use->libname == NULL) || ((tmp_use->libname != NULL) && (tmp_use->pkg_ptr != NULL)) ) { if (tmp_use->pkg_ptr != NULL) if (tmp_use->pkg_ptr->fpname != NULL) if (tmp_use->pkg_ptr->printed != TRUE) { /* * If the package has a body, and it has not been printed for this * top level arch (or config) yet, add it to the dependency list. * Note that we must clear 'printed' after every time we find a top * level arch (or config), as another top level arch could also * depend on the packages. */ tmp_use->pkg_ptr->printed = TRUE; strcpy(p, m2l(tmp_use->pkg_ptr->pname)); if (tmp_use->libname != NULL) { strcpy(libname, m2l(tmp_use->libname)); sprintf(print_string, "$(%s)$(S)%s.mg ", libname, p); } else { sprintf(print_string, "$(S)%s.mg ", p); } count = print_nice(print_string, count); tmp_use->pkg_ptr->used_by_toplevel = TRUE; } } else if (print_libs == TRUE) { strcpy(libname, m2l(tmp_use->libname)); strcpy(p, m2l(tmp_use->pname)); sprintf(print_string, "$(%s)$(S)%s.mg ", libname, p); count = print_nice(print_string, count); if (tmp_use->pkg_ptr != NULL) tmp_use->pkg_ptr->used_by_toplevel = TRUE; } /* * added Feb. 7/92 - hmt * need to recursively descend through the package dependencies on * packages, for mg at the build level. * additional modifications made on Feb. 18/92 - hmt */ if (tmp_use->pkg_ptr != NULL) if (tmp_use->pkg_ptr->pkg_body != NULL) count = check_package_body(tmp_use->pkg_ptr->pkg_body, count); if (tmp_use->pkg_ptr != NULL) if (tmp_use->pkg_ptr->pkg != NULL) count = check_package_body(tmp_use->pkg_ptr->pkg, count); tmp_use = tmp_use->next; /* end of mods */ } return(count); } build_libnames() { struct lib_names *tmp_lib; char libname[MAXTOKEN]; int printed; FILE *fp, *fopen(); int x; printed = FALSE; printf("VHOPTS =\n"); printf("MGOPTS =\n"); printf("BDOPTS =\n"); printf("SIM_OPTS = -notrace\n"); printf("HMT_OPTS =\n"); if (tool_set == INTERMETRICS) { printf("VHDL = vhdl\n"); printf("MG = mg\n"); printf("BD = build\n"); printf("SIM = sim\n"); } else if (tool_set == VANTAGE) { printf("VHDL = analyze\n"); printf("MG = @echo no mg phase for\n"); printf("BD = @echo no bd phase for\n"); printf("SIM = sim\n"); } else if (tool_set == MODELTECH) { printf("VHDL = vcom\n"); printf("MG = @echo no mg phase for\n"); printf("BD = @echo no bd phase for\n"); printf("SIM = vsim\n"); } else if (tool_set == SYNOPSYS) { printf("VHDL = vhdlan -nc\n"); printf("MG = @echo no mg phase for\n"); printf("BD = @echo no bd phase for\n"); printf("SIM = vhdlsim -t ns\n"); } /* added May 26/92 - hmt */ else if (tool_set == XL) { printf("VHDL = vsh -c analyze\n"); printf("MG = @echo no mg phase for\n"); printf("BD = @echo no bd phase for\n"); printf("SIM = vsh -c simulate\n"); } else if (tool_set == DASIX) { printf("DDBG =\n"); printf("DCHK =\n"); printf("DKIST =\n"); printf("VHDL = dvhdl -ace $(DDBG) $(DCHK) $(DLIST)\n"); printf("MG = @echo no mg phase for\n"); printf("BD = @echo no bd phase for\n"); printf("SIM = vsh -c simulate\n"); } /* REDAC added Aug. 12/92 - hmt */ else if (tool_set == REDAC) { printf("VHDL = analyze -d -O\n"); printf("MG = @echo no mg phase for\n"); printf("BD = @echo no bd phase for\n"); printf("SIM = simulate -c -p\n"); } else printf("ERROR: no such tool_set %d\n",tool_set); if (!state_files_in_current_directory) { /* * if the user wants the state files to be stored in the * subdirectory ".vmkr", then set the V flag to indicate so. */ printf("S = .vmkr/\n"); printf("TOUCH = @mkdir -p .vmkr ; touch $@\n"); } else { printf("S = .\n"); printf("TOUCH = @touch $@\n"); } printf("\n"); if ((fp = fopen(".makefile.include", "r")) != NULL) { /* * if there exists a file called ".makefile.include", in the current * directory, then print it out verbatim. */ x = fgetc(fp); while (x != EOF) { printf("%c",x); x = fgetc(fp); } } else { /* * if there was not include file, then print out library name * definitions. */ tmp_lib = header_lib; while (tmp_lib != NULL) { if (tmp_lib->current_dir == TRUE) { /* * currently, we print the exact same thing for a libname that * resides in the current directory as one that does not... but * we could in the future print something different. */ if (!printed) { printf("# note all directory definitions (if used) must end in /\n"); printf("# eg. ../dir_name/\n"); printed = TRUE; } strcpy(libname, m2l(tmp_lib->lib)); printf("%s =\n",libname); } else if (print_libs == TRUE) { if (!printed) { printf("# note all directory definitions must end in /\n"); printf("# eg. ../dir_name/\n"); printed = TRUE; } strcpy(libname, m2l(tmp_lib->lib)); printf("%s =\n",libname); } tmp_lib = tmp_lib->next; } } /*----*/fclose(fp); } print_nice(print_string, count) char *print_string; int count; { int tmp_count; tmp_count = count; if (tmp_count + strlen(print_string) > 78) { printf("\\\n\t"); tmp_count = 8; } printf("%s", print_string); tmp_count = tmp_count + strlen(print_string); return (tmp_count); }