1
1
mirror of https://github.com/kanaka/mal.git synced 2024-08-18 02:00:40 +03:00
mal/impls/objc/Makefile
Joel Martin 8a19f60386 Move implementations into impls/ dir
- Reorder README to have implementation list after "learning tool"
  bullet.

- This also moves tests/ and libs/ into impls. It would be preferrable
  to have these directories at the top level.  However, this causes
  difficulties with the wasm implementations which need pre-open
  directories and have trouble with paths starting with "../../". So
  in lieu of that, symlink those directories to the top-level.

- Move the run_argv_test.sh script into the tests directory for
  general hygiene.
2020-02-10 23:50:16 -06:00

51 lines
1.8 KiB
Makefile

STEP0_DEPS = mal_readline.c mal_readline.h
STEP1_DEPS = $(STEP0_DEPS) types.h types.m reader.h reader.m printer.h printer.m
STEP2_DEPS = $(STEP1_DEPS)
STEP3_DEPS = $(STEP2_DEPS) env.m
STEP4_DEPS = $(STEP3_DEPS) malfunc.h malfunc.m core.h core.m
STEPS = step0_repl step1_read_print step2_eval step3_env \
step4_if_fn_do step5_tco step6_file step7_quote \
step8_macros step9_try stepA_mal
# From: https://blog.tlensing.org/2013/02/24/objective-c-on-linux-setting-up-gnustep-clang-llvm-objective-c-2-0-blocks-runtime-gcd-on-ubuntu-12-04/:
# clang `gnustep-config --objc-flags` -o main -x objective-c main.m -fconstant-string-class=NSConstantString -fobjc-nonfragile-abi -fblocks -lgnustep-base -lgnustep-gui -ldispatch -I/usr/local/include/GNUstep -L/usr/local/lib/GNUstep
OS := $(shell uname)
## Bizzare gnustep-config/make interaction causes make to get run
## during gnustep-config so we need to remove make output
ifeq ($(OS),Darwin)
CC = clang -framework Foundation
OBJC_LIBS := -lobjc -lreadline
else
#CC = clang -fblocks -fobjc-nonfragile-abi -fobjc-arc
CC = clang -fblocks -fobjc-nonfragile-abi
OBJC_FLAGS := $(shell gnustep-config --objc-flags 2>/dev/null | egrep -v "Entering|Leaving")
OBJC_LIBS := $(filter-out -shared-libgcc,$(shell gnustep-config --base-libs 2>/dev/null | egrep -v "Entering|Leaving")) -ldispatch -lreadline
endif
all: $(STEPS)
dist: mal
mal: stepA_mal
cp $< $@
step0_repl: $(STEP0_DEPS)
step1_read_print: $(STEP1_DEPS)
step2_eval: $(STEP2_DEPS)
step3_env: $(STEP3_DEPS)
step4_if_fn_do step5_tco step6_file step7_quote step8_macros step9_try stepA_mal: $(STEP4_DEPS)
step%: step%.m
$(CC) \
-xobjective-c $(filter-out %.h mal_readline%,$+) \
-xc mal_readline.c \
-o $@ \
$(OBJC_FLAGS) \
$(OBJC_LIBS)
clean:
rm -f $(STEPS) *.o *.d mal