Differences From
Artifact [0390aebc43]:
1 1 #- modmake
2 2 # this is the master makefile that controls the building of each
3 3 # libk module. it is included from each k*/makefile.
4 4 # vim: ft=make
5 +
6 +include ../makerule
5 7
6 8 mod = $(notdir $(PWD))
7 9 src = $(wildcard *.c) $(wildcard *.s) $(filter-out %.h,$(patsubst %.m,%,$(wildcard *.m)))
8 10 bare = $(mod:k%=%)
9 11 headers = $(wildcard *.h) $(gen-headers) $(patsubst %.m,%,$(wildcard *.h.m))
10 12
11 13 tools = $(filter %.exe.c, $(src))
12 14 nontools = $(filter-out %.exe.c, $(src))
13 15 cobjects = $(filter %.c, $(nontools))
14 16 sobjects = $(filter %.${TARGET}.s, $(nontools))
15 17
16 -cflags = -std=c11 -isystem ${OUT} -isystem ${TMP} -isystem ${ROOT}/arch -fPIC -nostdlib ${COMPLIB} -L${OUT}
17 -
18 -m-env = atom_target_arch=${ARCH}
19 -m-env += atom_target_os=${OS}
20 -ifneq (${BITS},) #!!! ifdef does NOT work with environment variables
21 - m-env += atom_target_bits=${BITS}
22 -endif
23 -m-env += target_posix=${POSIX}
24 -m-env += target_unix=${UNIX}
25 -
26 -m-comp = ${m4} $(m-env:%=-D%)
27 -
28 18 obj: $(cobjects:%.c=${OUT}/$(mod).%.o) \
29 19 $(sobjects:%.s=${OUT}/$(mod).%.o)
30 20 tool: $(tools:%.exe.c=${OUT}/$(mod).%) \
31 21 ${OUT}/libk.a
32 22
33 23 def: $(headers:%=${OUT}/k/%)
34 24