Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application.mk:define main entry MAINNAME relatively #1979

Merged
merged 1 commit into from
Aug 24, 2023

Conversation

xuxin930
Copy link
Contributor

@xuxin930 xuxin930 commented Aug 18, 2023

Summary

this patch fix issue #633

  • issue
    when a program has multiple MAINSRC for incremental compilation, the PROGNAME of the compiled file may generate errors
 -------------------- compile definition error ---------------------
 cc -c -g CFLAGS INCLUDEDIR -Dmain=funA_main funB.c -o funB.c.path.o
                             ^^^^  ^^^^^^    ^^^^
-------------------------------------------------------------------
  • solution
    we use the MAINOBJ:PROGNAME mapping variable to define the main entry name, for example:
# this is Makefile in apps/examples/myapp for some app
# two programs need to be compiled
MAINSRC = demoA.c demoB.c
PROGNAME = runA runB
# In Application.mk, we will automatically define variables
# prefixed with 'PROGKEY_' or 'ELFPROGKEY_'
# which used depends on builtin or elf

PROGKEY_home.apps.examples.myapp.demoA.o := runA
PROGKEY_apps.examples.myapp.demoB.o := runB

ELFPROGKEY_/home/apps/bin/runA :=  apps.examples.myapp.demoA.o
ELFPROGKEY_/home/apps/bin/runB :=  apps.examples.myapp.demoB.o

Use the mapped variable and cooperate with the target $@, so that the mismatch situation can be solved.

Impact

compilation and incremental compilation of all applications (include ELF mode)

Testing

CI build

@vikewang
Copy link

very good!

@xiaoxiang781216 xiaoxiang781216 linked an issue Aug 20, 2023 that may be closed by this pull request
Application.mk Outdated Show resolved Hide resolved
Application.mk Outdated Show resolved Hide resolved
Application.mk Outdated Show resolved Hide resolved
Application.mk Show resolved Hide resolved
Application.mk Show resolved Hide resolved
Application.mk Outdated Show resolved Hide resolved
Application.mk Outdated Show resolved Hide resolved
Application.mk Outdated Show resolved Hide resolved
@xuxin930 xuxin930 marked this pull request as draft August 22, 2023 11:33
Application.mk Outdated Show resolved Hide resolved
@xuxin930 xuxin930 force-pushed the fix-incremental-compile branch 2 times, most recently from 571d8c1 to c2ece5a Compare August 24, 2023 10:18
when a program has multiple MAINSRC for incremental compilation,
the PROGNAME of the compiled file may generate errors
-------------------- compile definition error ---------------------
cc -c -g CFLAGS INCLUDEDIR -Dmain=funA_main funB.c -o funB.c.path.o
                             ^^^^  ^^^^^^    ^^^^
-------------------------------------------------------------------
use the MAINOBJ:PROGNAME mapping variable to define the main entry name

Signed-off-by: xuxin19 <[email protected]>
@xuxin930 xuxin930 marked this pull request as ready for review August 24, 2023 12:11
@xiaoxiang781216 xiaoxiang781216 merged commit 4765cc3 into apache:master Aug 24, 2023
25 checks passed
@xuxin930 xuxin930 deleted the fix-incremental-compile branch October 17, 2024 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mutliple PROGNAME not working correctly
3 participants