mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Tweaked a build var name
This commit is contained in:
18
makefile
18
makefile
@@ -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
|
||||
|
||||
repl-static: $(OUTDIR) static
|
||||
repl-static: $(TOY_OUTDIR) static
|
||||
$(MAKE) -C repl
|
||||
|
||||
library: $(OUTDIR)
|
||||
library: $(TOY_OUTDIR)
|
||||
$(MAKE) -C source library
|
||||
|
||||
static: $(OUTDIR)
|
||||
static: $(TOY_OUTDIR)
|
||||
$(MAKE) -C source static
|
||||
|
||||
test: clean $(OUTDIR)
|
||||
test: clean $(TOY_OUTDIR)
|
||||
$(MAKE) -C test
|
||||
|
||||
$(OUTDIR):
|
||||
mkdir $(OUTDIR)
|
||||
$(TOY_OUTDIR):
|
||||
mkdir $(TOY_OUTDIR)
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
|
||||
@@ -8,10 +8,10 @@ ODIR = obj
|
||||
SRC = $(wildcard *.c)
|
||||
OBJ = $(addprefix $(ODIR)/,$(SRC:.c=.o))
|
||||
|
||||
OUT=../$(OUTDIR)/toyrepl
|
||||
OUT=../$(TOY_OUTDIR)/toyrepl
|
||||
|
||||
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)
|
||||
|
||||
|
||||
@@ -11,16 +11,16 @@ OBJ = $(addprefix $(ODIR)/,$(SRC:.c=.o))
|
||||
OUTNAME=toy
|
||||
|
||||
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
|
||||
OUT=../$(OUTDIR)/$(OUTNAME).dll
|
||||
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=../$(TOY_OUTDIR)/$(OUTNAME).dll
|
||||
else ifeq ($(shell uname),Linux)
|
||||
#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
|
||||
OUT=../$(OUTDIR)/$(OUTNAME)
|
||||
LIBLINE=-Wl,--out-implib=../$(TOY_OUTDIR)/lib$(OUTNAME).a -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive
|
||||
OUT=../$(TOY_OUTDIR)/$(OUTNAME)
|
||||
CFLAGS += -fPIC
|
||||
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
|
||||
OUT=../$(OUTDIR)/$(OUTNAME).dll
|
||||
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=../$(TOY_OUTDIR)/$(OUTNAME).dll
|
||||
else
|
||||
@echo "Platform test failed - what platform is this?"
|
||||
exit 1
|
||||
@@ -30,7 +30,7 @@ library: $(OBJ)
|
||||
$(CC) -DTOY_EXPORT $(CFLAGS) -shared -o $(OUT) $(LIBLINE)
|
||||
|
||||
static: $(OBJ)
|
||||
ar crs ../$(OUTDIR)/lib$(OUTNAME).a $(OBJ)
|
||||
ar crs ../$(TOY_OUTDIR)/lib$(OUTNAME).a $(OBJ)
|
||||
|
||||
$(OBJ): | $(ODIR)
|
||||
|
||||
|
||||
@@ -9,11 +9,11 @@ TARGETS = $(wildcard ../source/*.c) $(filter-out $(wildcard ../repl/*main.c),$(w
|
||||
TESTS = $(wildcard *.c)
|
||||
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)
|
||||
ifeq ($(shell uname),Linux)
|
||||
valgrind --leak-check=full --track-origins=yes $@
|
||||
|
||||
Reference in New Issue
Block a user