libk  Diff

Differences From Artifact [75ffd11290]:

To Artifact [e2aa0ec204]:


     1         -export OUT=$(PWD)/out
     2         -export TARGET=x86.lin.64
            1  +export OUT = $(PWD)/out
            2  +
            3  +export ARCH = x86
            4  +export OS = lin
            5  +export BITS = 64
            6  +
            7  +export TARGET = $(ARCH).$(OS).$(BITS)
            8  +
            9  +moddirs = $(wildcard k*)
           10  +modules = $(moddirs:k%=%)
           11  +headers = $(moddirs:k%=$(OUT)/k/%.h)
           12  +objects = $(modules:%=$(OUT)/k%.o)
           13  +makefiles = $(moddirs:%=%/makefile)
           14  +
           15  +binaries = $(wildcard */exe.*.c)
           16  +binmods = $(sort $(dir $(binaries)))
           17  +
           18  +all: obj defs tool
           19  +obj: $(moddirs:%=%.obj)
           20  +defs: $(headers)
           21  +tool: $(binmods:%=%.tool)
           22  +
           23  +lists = moddirs modules headers objects makefiles binaries binmods
           24  +dbg:
           25  +	@echo -e lists: $(foreach var, $(lists), "\\n - \\e[1m$(var)\\e[m = $($(var))")
           26  +
           27  +%.obj: %/makefile $(OUT)
           28  +	cd $* && $(MAKE) obj
           29  +
           30  +%.tool: %/makefile $(OUT)
           31  +	cd $* && $(MAKE) tool
           32  +
           33  +%.dbg: %/makefile $(OUT)
           34  +	cd $* && $(MAKE) dbg
           35  +
           36  +$(OUT)/libk.so: mods $(OUT)
           37  +	$(CC) -shared -o $@ $(objects)
           38  +
           39  +$(OUT)/libk.a: mods $(OUT)
           40  +	# using `ar c` and ranlib here instead of
           41  +	# `ar cs` in case `ar` isn't the GNU version
           42  +	ar c $@ $(objects)
           43  +	ranlib $@
     3     44   
     4         -all: kio
           45  +$(OUT)/k/%.h: k%/makefile $(OUT)/k
           46  +	cd k$* && $(MAKE) $@
     5     47   
     6         -$(OUT)/kio.o:
     7         -	cd kio && make kio
           48  +$(OUT) $(OUT)/k:
           49  +	mkdir -p $@