Skip to content

Commit f8631e5

Browse files
committed
userland: create interactive example
1 parent 26b890f commit f8631e5

File tree

5 files changed

+14
-2
lines changed

5 files changed

+14
-2
lines changed

userland/Makefile

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@ CFLAGS = -fopenmp -std=c99 $(CCFLAGS) $(CFLAGS_EXTRA)
55
CXXFLAGS = -std=c++17 $(CCFLAGS) $(CXXFLAGS_EXTRA)
66
# -Wno-unused-function for function definitions on headers,
77
# because we are lazy to make a shared object. TODO.
8-
COMMON_DIR = ..
8+
COMMON_DIR = $(CURDIR)/..
99
COMMON_BASENAME = common
1010
COMMON_OBJ = $(OUT_DIR)/$(COMMON_BASENAME)$(OBJ_EXT)
1111
IN_EXT_C = .c
1212
IN_EXT_CXX = .cpp
1313
LIBS = -lm
1414
OBJ_EXT = .o
1515
OUT_EXT = .out
16-
OUT_DIR = .
16+
OUT_DIR = $(CURDIR)
17+
18+
-include params.mk
1719

1820
OUTS := $(foreach IN_EXT,$(IN_EXT_C) $(IN_EXT_CXX),$(addsuffix $(OUT_EXT), $(basename $(wildcard *$(IN_EXT)))))
1921
ifeq ($(HAS_EIGEN),y)
@@ -41,6 +43,9 @@ endif
4143
OUTS := $(addprefix $(OUT_DIR)/,$(OUTS))
4244

4345
all: mkdir $(OUTS)
46+
for subdir in $(SUBDIRS); do \
47+
$(MAKE) -C $${subdir} OUT_DIR="$(OUT_DIR)/$$subdir"; \
48+
done
4449

4550
$(COMMON_OBJ): $(COMMON_DIR)/$(COMMON_BASENAME)$(IN_EXT_C)
4651
$(CC) $(CFLAGS) -c -o '$@' '$<' $(LIBS)
@@ -53,6 +58,9 @@ $(OUT_DIR)/%$(OUT_EXT): %$(IN_EXT_CXX) $(COMMON_OBJ)
5358

5459
clean:
5560
rm -f *'$(OBJ_EXT)' *'$(OUT_EXT)'
61+
for subdir in $(SUBDIRS); do \
62+
$(MAKE) -C $${subdir} clean; \
63+
done
5664

5765
mkdir:
5866
mkdir -p '$(OUT_DIR)'

userland/interactive/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../Makefile

userland/interactive/assert_fail.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../baremetal/interactive/assert_fail.c

userland/interactive/params.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
COMMON_DIR = ../..

userland/params.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
SUBDIRS := interactive

0 commit comments

Comments
 (0)