Tweaked a build var name

This commit is contained in:
2022-09-18 07:26:23 +01:00
parent 64cc514171
commit c680427b1e
4 changed files with 21 additions and 21 deletions

View File

@@ -1,24 +1,24 @@
export OUTDIR = out export TOY_OUTDIR = out
all: $(OUTDIR) repl all: $(TOY_OUTDIR) repl
repl: $(OUTDIR) library repl: $(TOY_OUTDIR) library
$(MAKE) -C repl $(MAKE) -C repl
repl-static: $(OUTDIR) static repl-static: $(TOY_OUTDIR) static
$(MAKE) -C repl $(MAKE) -C repl
library: $(OUTDIR) library: $(TOY_OUTDIR)
$(MAKE) -C source library $(MAKE) -C source library
static: $(OUTDIR) static: $(TOY_OUTDIR)
$(MAKE) -C source static $(MAKE) -C source static
test: clean $(OUTDIR) test: clean $(TOY_OUTDIR)
$(MAKE) -C test $(MAKE) -C test
$(OUTDIR): $(TOY_OUTDIR):
mkdir $(OUTDIR) mkdir $(TOY_OUTDIR)
.PHONY: clean .PHONY: clean

View File

@@ -8,10 +8,10 @@ ODIR = obj
SRC = $(wildcard *.c) SRC = $(wildcard *.c)
OBJ = $(addprefix $(ODIR)/,$(SRC:.c=.o)) OBJ = $(addprefix $(ODIR)/,$(SRC:.c=.o))
OUT=../$(OUTDIR)/toyrepl OUT=../$(TOY_OUTDIR)/toyrepl
all: $(OBJ) all: $(OBJ)
$(CC) -DTOY_IMPORT $(CFLAGS) -o $(OUT) $(OBJ) -L$(realpath $(shell pwd)/../$(OUTDIR)) $(LIBS) $(CC) -DTOY_IMPORT $(CFLAGS) -o $(OUT) $(OBJ) -L$(realpath $(shell pwd)/../$(TOY_OUTDIR)) $(LIBS)
$(OBJ): | $(ODIR) $(OBJ): | $(ODIR)

View File

@@ -11,16 +11,16 @@ OBJ = $(addprefix $(ODIR)/,$(SRC:.c=.o))
OUTNAME=toy OUTNAME=toy
ifeq ($(findstring CYGWIN, $(shell uname)),CYGWIN) ifeq ($(findstring CYGWIN, $(shell uname)),CYGWIN)
LIBLINE =-Wl,--out-implib=../$(OUTDIR)/lib$(OUTNAME).dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive LIBLINE =-Wl,--out-implib=../$(TOY_OUTDIR)/lib$(OUTNAME).dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
OUT=../$(OUTDIR)/$(OUTNAME).dll OUT=../$(TOY_OUTDIR)/$(OUTNAME).dll
else ifeq ($(shell uname),Linux) else ifeq ($(shell uname),Linux)
#I can't get this working as a shared lib #I can't get this working as a shared lib
LIBLINE=-Wl,--out-implib=../$(OUTDIR)/lib$(OUTNAME).a -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive LIBLINE=-Wl,--out-implib=../$(TOY_OUTDIR)/lib$(OUTNAME).a -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
OUT=../$(OUTDIR)/$(OUTNAME) OUT=../$(TOY_OUTDIR)/$(OUTNAME)
CFLAGS += -fPIC CFLAGS += -fPIC
else ifeq ($(OS),Windows_NT) else ifeq ($(OS),Windows_NT)
LIBLINE =-Wl,--out-implib=../$(OUTDIR)/lib$(OUTNAME).dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive LIBLINE =-Wl,--out-implib=../$(TOY_OUTDIR)/lib$(OUTNAME).dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
OUT=../$(OUTDIR)/$(OUTNAME).dll OUT=../$(TOY_OUTDIR)/$(OUTNAME).dll
else else
@echo "Platform test failed - what platform is this?" @echo "Platform test failed - what platform is this?"
exit 1 exit 1
@@ -30,7 +30,7 @@ library: $(OBJ)
$(CC) -DTOY_EXPORT $(CFLAGS) -shared -o $(OUT) $(LIBLINE) $(CC) -DTOY_EXPORT $(CFLAGS) -shared -o $(OUT) $(LIBLINE)
static: $(OBJ) static: $(OBJ)
ar crs ../$(OUTDIR)/lib$(OUTNAME).a $(OBJ) ar crs ../$(TOY_OUTDIR)/lib$(OUTNAME).a $(OBJ)
$(OBJ): | $(ODIR) $(OBJ): | $(ODIR)

View File

@@ -9,11 +9,11 @@ TARGETS = $(wildcard ../source/*.c) $(filter-out $(wildcard ../repl/*main.c),$(w
TESTS = $(wildcard *.c) TESTS = $(wildcard *.c)
OBJ = $(addprefix $(ODIR)/,$(TARGETS:../source/%.c=%.o)) $(addprefix $(ODIR)/,$(TESTS:.c=.o)) OBJ = $(addprefix $(ODIR)/,$(TARGETS:../source/%.c=%.o)) $(addprefix $(ODIR)/,$(TESTS:.c=.o))
.PRECIOUS: $(TESTS:%.c=../$(OUTDIR)/%.exe) .PRECIOUS: $(TESTS:%.c=../$(TOY_OUTDIR)/%.exe)
all: $(OBJ) $(TESTS:%.c=../$(OUTDIR)/%.exe) all: $(OBJ) $(TESTS:%.c=../$(TOY_OUTDIR)/%.exe)
../$(OUTDIR)/%.exe: $(ODIR)/%.o ../$(TOY_OUTDIR)/%.exe: $(ODIR)/%.o
@$(CC) -o $@ $< $(TARGETS:../source/%.c=$(ODIR)/%.o) $(CFLAGS) $(LIBS) @$(CC) -o $@ $< $(TARGETS:../source/%.c=$(ODIR)/%.o) $(CFLAGS) $(LIBS)
ifeq ($(shell uname),Linux) ifeq ($(shell uname),Linux)
valgrind --leak-check=full --track-origins=yes $@ valgrind --leak-check=full --track-origins=yes $@