Skip to content

Commit

Permalink
improve dependencies management when compiling pok source code (only …
Browse files Browse the repository at this point in the history
…compile a source file when its dependencies have been modified)
  • Loading branch information
Etienne13 committed Jun 29, 2019
1 parent 638a32b commit 6b04870
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 15 deletions.
2 changes: 1 addition & 1 deletion libpok/core/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ depend:

include $(TOPDIR)/misc/mk/rules-common.mk
include $(TOPDIR)/misc/mk/rules-partition.mk

-include .depend.mk
4 changes: 2 additions & 2 deletions libpok/drivers/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LO_OBJS= rtl8029.o

LO_DEPS=

all: $(LO_TARGET)
all: depend $(LO_TARGET)

.PHONY: clean distclean depend all

Expand All @@ -25,4 +25,4 @@ depend:

include $(TOPDIR)/misc/mk/rules-common.mk
include $(TOPDIR)/misc/mk/rules-partition.mk

-include .depend.mk
4 changes: 4 additions & 0 deletions libpok/include/core/dependencies.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
#ifndef __LIBPOK_DEPENDENCIES_H__
#define __LIBPOK_DEPENDENCIES_H__

#if defined POK_CONFIG_OPTIMIZE_FOR_GENERATED_CODE && defined GENERATED_CODE_PATH
#include "deployment.h"
#endif


#ifdef POK_CONFIG_OPTIMIZE_FOR_GENERATED_CODE

Expand Down
3 changes: 2 additions & 1 deletion libpok/libc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LO_OBJS=
LO_DEPS= stdio/stdio.lo string/string.lo misc/misc.lo stdlib/stdlib.lo


all: $(LO_TARGET)
all: depend $(LO_TARGET)

stdio/stdio.lo::
$(CD) stdio && $(MAKE)
Expand Down Expand Up @@ -50,3 +50,4 @@ depend:

include $(TOPDIR)/misc/mk/rules-common.mk
include $(TOPDIR)/misc/mk/rules-partition.mk
-include .depend.mk
2 changes: 1 addition & 1 deletion libpok/libc/misc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ distclean:
$(RM) .depend.mk

depend:
$(if $(LO_OBJS), $(CC) $(CFLAGS) -MM $(wildcard *.c) $(wildcard *.S) > .depend.mk,)
$(if $(LO_OBJS), $(CC) $(CFLAGS) $(COPTS) -MM $(wildcard *.c) $(wildcard *.S) > .depend.mk,)

include $(TOPDIR)/misc/mk/rules-common.mk
include $(TOPDIR)/misc/mk/rules-partition.mk
3 changes: 2 additions & 1 deletion libpok/libc/stdio/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LO_OBJS= printf.o

LO_DEPS=

all: $(LO_TARGET)
all: depend $(LO_TARGET)

.PHONY: clean distclean depend all

Expand All @@ -27,3 +27,4 @@ depend:

include $(TOPDIR)/misc/mk/rules-common.mk
include $(TOPDIR)/misc/mk/rules-partition.mk
-include .depend.mk
5 changes: 3 additions & 2 deletions libpok/libc/stdlib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ LO_OBJS= rand.o \

LO_DEPS=

all: $(LO_TARGET)
all: depend $(LO_TARGET)

.PHONY: clean distclean depend all

Expand All @@ -26,7 +26,8 @@ distclean:
$(RM) .depend.mk

depend:
$(if $(LO_OBJS), $(CC) $(CFLAGS) -MM $(wildcard *.c) $(wildcard *.S) > .depend.mk,)
$(if $(LO_OBJS), $(CC) $(CFLAGS) $(COPTS) -MM $(wildcard *.c) $(wildcard *.S) > .depend.mk,)

include $(TOPDIR)/misc/mk/rules-common.mk
include $(TOPDIR)/misc/mk/rules-partition.mk
-include .depend.mk
5 changes: 3 additions & 2 deletions libpok/libc/string/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ LO_OBJS= itoa.o \
# XXX: Compile arch optimized versions
LO_DEPS=

all: $(LO_TARGET)
all: depend $(LO_TARGET)


.PHONY: clean distclean depend all
Expand All @@ -32,7 +32,8 @@ distclean:
$(RM) .depend.mk

depend:
$(if $(LO_OBJS), $(CC) $(CFLAGS) -MM $(wildcard *.c) $(wildcard *.S) > .depend.mk,)
$(if $(LO_OBJS), $(CC) $(CFLAGS) $(COPTS) -MM $(wildcard *.c) $(wildcard *.S) > .depend.mk,)

include $(TOPDIR)/misc/mk/rules-common.mk
include $(TOPDIR)/misc/mk/rules-partition.mk
-include .depend.mk
6 changes: 3 additions & 3 deletions libpok/libm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ LO_DEPS=

all: $(LO_TARGET)

.PHONY: clean distclean depend all
.PHONY: depend all

clean:
$(RM) $(LO_OBJS)
Expand All @@ -179,8 +179,8 @@ distclean:
$(RM) .depend.mk

depend:
$(if $(LO_OBJS), $(CC) $(CFLAGS) -MM $(wildcard *.c) $(wildcard *.S) > .depend.mk,)
$(if $(LO_OBJS), $(CC) $(CFLAGS) $(COPTS) -MM $(wildcard *.c) $(wildcard *.S) > .depend.mk,)

include $(TOPDIR)/misc/mk/rules-common.mk
include $(TOPDIR)/misc/mk/rules-partition.mk

-include .depend.mk
2 changes: 1 addition & 1 deletion misc/mk/rules-kernel.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ endif
kernel: $(TARGET_KERNEL)

$(TARGET_KERNEL): $(DEPLOYMENT_HEADER)
$(CD) $(POK_PATH)/kernel && $(MAKE) distclean all
$(CD) $(POK_PATH)/kernel && $(MAKE) all

copy-kernel:
$(CP) $(POK_PATH)/kernel/pok.lo $(shell pwd)/
Expand Down
2 changes: 1 addition & 1 deletion misc/mk/rules-partition.mk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ endif
libpok: $(TARGET_LIBPOK)

$(TARGET_LIBPOK): $(DEPLOYMENT_HEADER)
$(CD) $(POK_PATH)/libpok && $(MAKE) clean all
$(CD) $(POK_PATH)/libpok && $(MAKE) all
$(CP) $(POK_PATH)/libpok/libpok.a `pwd`/
$(ECHO) $(ECHO_FLAGS) $(ECHO_FLAGS_ONELINE) "[AR] libpart.a "
$(AR) -x libpok.a
Expand Down

0 comments on commit 6b04870

Please sign in to comment.