Allows running the tests out-of-the-box on macOS. Also delete *.dylib in tests2 dir on "make clean". One remaining issue on macOS 14.1 is that the -undefined warning option no longer works, thus breaking test3 and test1b.
Unified · Split
| @@ -77,6 +77,12 @@ TCCFLAGS = $(TCCFLAGS$(CFG)) · 76 unmodified lines | ||
| 77 | 77 | TCC_LOCAL = $(TOP)/tcc$(EXESUF) |
| 78 | 78 | TCC = $(TCC_LOCAL) $(TCCFLAGS) |
| 79 | 79 | |
| 80 | +ifdef CONFIG_OSX | |
| 81 | +CODESIGN = codesign -s - | |
| 82 | +else | |
| 83 | +CODESIGN = true | |
| 84 | +endif | |
| 85 | + | |
| 80 | 86 | CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE |
| 81 | 87 | LIBS_P = $(LIBS) |
| 82 | 88 | LDFLAGS_P = $(LDFLAGS) |
| @@ -81,7 +81,7 @@ all test : · 80 unmodified lines | ||
| 81 | 81 | |
| 82 | 82 | hello-exe: ../examples/ex1.c |
| 83 | 83 | @echo ------------ $@ ------------ |
| 84 | − $(TCC) $< -o hello$(EXESUF) && ./hello$(EXESUF) || $(DUMPTCC) | |
| 84 | + $(TCC) $< -o hello$(EXESUF) && $(CODESIGN) hello$(EXESUF) && ./hello$(EXESUF) || $(DUMPTCC) | |
| 85 | 85 | |
| 86 | 86 | hello-run: ../examples/ex1.c |
| 87 | 87 | @echo ------------ $@ ------------ |
| @@ -156,7 +156,9 @@ test4_static: tcctest.c test.ref · 68 unmodified lines | ||
| 156 | 156 | dlltest: |
| 157 | 157 | @echo ------------ $@ ------------ |
| 158 | 158 | $(TCC) $(NATIVE_DEFINES) -DLIBTCC_AS_DLL $(TOPSRC)/libtcc.c $(LIBS) -shared -o libtcc2$(DLLSUF) |
| 159 | + $(CODESIGN) libtcc2$(DLLSUF) | |
| 159 | 160 | $(TCC) $(NATIVE_DEFINES) -DONE_SOURCE=0 $(TOPSRC)/tcc.c libtcc2$(DLLSUF) $(LIBS) -Wl,-rpath=. -o tcc2$(EXESUF) |
| 161 | + $(CODESIGN) tcc2$(EXESUF) | |
| 160 | 162 | ./tcc2$(EXESUF) $(TCCFLAGS) $(RUN_TCC) -run $(TOPSRC)/examples/ex1.c |
| 161 | 163 | ifeq (,$(filter Darwin WIN32,$(TARGETOS))) |
| 162 | 164 | @echo ------------ $@ with PIC ------------ |
| @@ -241,6 +243,7 @@ abitest-cc.exe: abitest.c $(LIBTCC) · 78 unmodified lines | ||
| 241 | 243 | |
| 242 | 244 | abitest-tcc.exe: abitest.c libtcc.c |
| 243 | 245 | $(TCC) -o $@ $^ $(NATIVE_DEFINES) $(LIBS) |
| 246 | + $(CODESIGN) $@ | |
| 244 | 247 | |
| 245 | 248 | abitest-% : abitest-%.exe |
| 246 | 249 | @echo ------------ $@ ------------ |
| @@ -253,6 +256,7 @@ endif · 6 unmodified lines | ||
| 253 | 256 | |
| 254 | 257 | vla_test$(EXESUF): vla_test.c |
| 255 | 258 | $(TCC) -o $@ $^ |
| 259 | + $(CODESIGN) $@ | |
| 256 | 260 | |
| 257 | 261 | vla_test-run: vla_test$(EXESUF) |
| 258 | 262 | @echo ------------ $@ ------------ |
| @@ -105,8 +105,11 @@ GEN-ALWAYS = · 104 unmodified lines | ||
| 105 | 105 | # this test creates two DLLs and an EXE |
| 106 | 106 | 113_btdll.test: T1 = \ |
| 107 | 107 | $(TCC) -bt $1 -shared -D DLL=1 -o a1$(DLLSUF) && \ |
| 108 | + $(CODESIGN) a1$(DLLSUF) && \ | |
| 108 | 109 | $(TCC) -bt $1 -shared -D DLL=2 -o a2$(DLLSUF) && \ |
| 110 | + $(CODESIGN) a2$(DLLSUF) && \ | |
| 109 | 111 | $(TCC) -bt $1 a1$(DLLSUF) a2$(DLLSUF) -Wl,-rpath=. -o $(basename $@).exe && \ |
| 112 | + $(CODESIGN) $(basename $@).exe && \ | |
| 110 | 113 | ./$(basename $@).exe |
| 111 | 114 | |
| 112 | 115 | 114_bound_signal.test: FLAGS += -b |
| @@ -136,7 +139,7 @@ all test tests2.all: $(filter-out $(SKIP),$(TESTS)) · 23 unmodified lines | ||
| 136 | 139 | @$(call T1,$<) $(T3) |
| 137 | 140 | |
| 138 | 141 | T1 = $(TCC) $(FLAGS) $(T2) $(ARGS) |
| 139 | −T2 = $(if $(NORUN),$1 -o $(basename $@).exe && ./$(basename $@).exe,-run $1) | |
| 142 | +T2 = $(if $(NORUN),$1 -o $(basename $@).exe && $(CODESIGN) $(basename $@).exe && ./$(basename $@).exe,-run $1) | |
| 140 | 143 | T3 = $(FILTER) >$*.output 2>&1 || true \ |
| 141 | 144 | && diff -Nbu $(filter %.expect,$^) $*.output \ |
| 142 | 145 | && rm -f $*.output $(filter $*.expect,$(GEN-ALWAYS)) |
| @@ -177,4 +180,4 @@ $(sort $(GEN-ALWAYS) $(UPDATE)) : force · 34 unmodified lines | ||
| 177 | 180 | force: |
| 178 | 181 | |
| 179 | 182 | clean : |
| 180 | − rm -f fred.txt *.output *.exe *.dll *.so *.def $(GEN-ALWAYS) | |
| 183 | + rm -f fred.txt *.output *.exe *.dll *.so *.dylib *.def $(GEN-ALWAYS) | |