Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22024

Makefile can I execute a configuration only once? | GCC error cant have two main functions

$
0
0

Im trying to create a Makefile which compiles some files and creates some outputs but first I want it to execute the configuration only one time and the next time I type make it wont re-execute the configuration unless I change the parameters for example the prefix.

I tried using touch , FORCE and if, after searching a bit in other posts but Im newbie in gcc and Makefiles so I cant make it work.

My code now is (did not include the other rules because they dont affect the configuration):

XLEN := 32RISCV_PREFIX := riscv$(XLEN)-unknown-elf-RISCV_GCC := $(RISCV_PREFIX)gccCFLAGS := -O2WORKING_DIR:= $(shell pwd)LIBRARY_DIR:= $(abspath $(dir $(lastword $(MAKEFILE_LIST)))/..)B := $(shell echo $(LIBRARY_DIR))$(info $(B))

--->(execute this only once)--->CONFIGURATION := configure --prefix=$(LIBRARY_DIR) --with-arch=rv32if --with-abi=ilp32d

RISCV_TEST_DIR:=$(shell pwd)SCRIPTDIR:=$(RISCV_TEST_DIR)/../../toolsall: $(PROGRAMS_TO_CREATE); if [ -a $(LIBRARY_DIR)/config.status ]; then cd $(LIBRARY_DIR) && $(CONFIGURATION); fi;configure: config.status    touch configureconfig.status:    cd $(LIBRARY_DIR) && $(CONFIGURATION);.PHONY: all cleanclean:    $(info Cleaning files...)    @rm -rf *.elf *.hex *.map *.objdump *.i *.s *.bin *.dump    $(info Done cleaning!)

Lastly I want the makefile to compile all .c files but it says that I can not have two main() functions and as I have seen from other forum posts I have to rename them or include them in 1 file. The problem is that these .c files are different from each other, one executes multiplication and the other additions. I tried using:

ALL_PROGRAMS = copy.c sec_soft.c new_sec_soft.cALL_HEX = $(ALL_PROGRAMS:%.c=%.hex)

Thank you in advance!


Viewing all articles
Browse latest Browse all 22024

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>