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

Make: generate dependency files #85

Merged
merged 3 commits into from
Aug 30, 2020

Conversation

bjoernd
Copy link
Contributor

@bjoernd bjoernd commented Aug 30, 2020

Generate dependency files for our C files so that we actually rebuild them when
local header files are modified.

Signed-off-by: Bjoern Doebel [email protected]

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@bjoernd
Copy link
Contributor Author

bjoernd commented Aug 30, 2020

Testing

BEFORE

$ touch include/slab.h
$ make
DIST=Fedora
make: Nothing to be done for 'all'.

AFTER

$ touch include/slab.h
$ make
DIST=Fedora
CC  common/setup.o
CC  mm/slab.o
LD  kernel64.bin
GEN  symbols.S
CC  symbols.S
LD  kernel64.bin symbols.o

Makefile Outdated
@@ -89,9 +89,14 @@ $(TARGET): $(OBJS)
@echo "AS " $@
@ $(CC) -c -o $@ $(AFLAGS) $<

DEPFLAGS := -MMD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The flag is already part of COMMON_FLAGS.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fun. Then we only need the rule to actually include those dep files.

Makefile Outdated
%.o: %.c
@echo "CC " $@
@ $(CC) -c -o $@ $(CFLAGS) $<
@$(CC) -c -o $@ $(CFLAGS) $(DEPFLAGS) $<
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not needed, -MMD should be there

@wipawel
Copy link
Contributor

wipawel commented Aug 30, 2020

While we are at it, can we also store all *.d in a dedicated dir like: .deps ?

Is the dependency for a linker script also covered?

@bjoernd
Copy link
Contributor Author

bjoernd commented Aug 30, 2020

While we are at it, can we also store all *.d in a dedicated dir like: .deps ?

Let's leave that for later.

Is the dependency for a linker script also covered?

I pulled the PREP_LINK_SCRIPT generation into a separate rule.

wipawel
wipawel previously approved these changes Aug 30, 2020
Makefile Outdated

%.o: %.S
@echo "AS " $@
@ $(CC) -c -o $@ $(AFLAGS) $<

%.o: %.c
@echo "CC " $@
@ $(CC) -c -o $@ $(CFLAGS) $<
@$(CC) -c -o $@ $(CFLAGS) $<
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: change not needed

Generate dependency files for our C files so that we actually rebuild them when
local header files are modified.

Signed-off-by: Bjoern Doebel <[email protected]>
@bjoernd bjoernd merged commit 807d3c1 into KernelTestFramework:mainline Aug 30, 2020
@bjoernd bjoernd deleted the make-dep branch August 30, 2020 18:23
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.

2 participants