Blame src/functional/Makefile

nsz 63c044
CFLAGS+=-pipe -std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Wno-unused-function -Wno-missing-braces
nsz 63c044
LDFLAGS+=
Szabolcs Nagy 054f47
LDLIBS+=
nsz 63c044
nsz 63c044
SRC=$(sort $(wildcard *.c))
nsz 63c044
OBJ=$(SRC:.c=.o)
nsz 63c044
DSOOBJ=$(filter %_dso.o,$(OBJ))
nsz 63c044
BINOBJ=$(filter-out %_dso.o,$(OBJ))
Szabolcs Nagy 054f47
NO_DL_OBJ=$(filter-out %dlopen.o,$(BINOBJ))
nsz 63c044
DSO=$(DSOOBJ:.o=.so)
nsz 63c044
BIN=$(BINOBJ:.o=)
Szabolcs Nagy 054f47
BIN_STATIC=$(NO_DL_OBJ:.o=-static)
Szabolcs Nagy 054f47
ALL=$(BIN) $(BIN_STATIC) $(DSO)
nsz 63c044
nsz 63c044
-include ../../config.mak
nsz 63c044
Szabolcs Nagy 054f47
all: $(ALL)
nsz 63c044
run: all
Szabolcs Nagy 054f47
	@N=0; A=0; for i in $(BIN) $(BIN_STATIC);do \
Szabolcs Nagy 054f47
		A=$$((A+1)); ./$$i || { N=$$((N+1)); echo FAIL $$i; } \
Szabolcs Nagy 054f47
	done; \
Szabolcs Nagy 054f47
	[ "$$N" = 0 ] && echo PASS || echo FAILS: $$N/$$A
nsz 63c044
clean:
Szabolcs Nagy 054f47
	rm -f $(OBJ) $(ALL)
nsz 63c044
nsz 63c044
$(OBJ): test.h
Szabolcs Nagy 054f47
$(DSOOBJ): CFLAGS+=-fPIC
nsz c87894
%.o: %.c
Szabolcs Nagy 054f47
	$(CC) $(CFLAGS) -c -o $@ $< || echo BUILDERROR $@
nsz 63c044
%.so: %.o
Szabolcs Nagy 054f47
	$(CC) -shared $(LDFLAGS) -o $@ $< $(LDLIBS) || echo BUILDERROR $@
Szabolcs Nagy 054f47
%-static: %.o
Szabolcs Nagy 054f47
	$(CC) -static $(LDFLAGS) -o $@ $< $(LDLIBS) || echo BUILDERROR $@
nsz 63c044
%: %.o
Szabolcs Nagy 054f47
	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS) || echo BUILDERROR $@
nsz 49b23c
Szabolcs Nagy 054f47
dlopen: LDLIBS+=-ldl -rdynamic
Szabolcs Nagy 054f47
pthread pthread-static: LDLIBS+=-lpthread
Szabolcs Nagy 054f47
sem sem-static: LDLIBS+=-lpthread -lrt
Szabolcs Nagy 054f47
strtod_simple strtod_simple-static: LDLIBS+=-lm
Szabolcs Nagy 054f47
tgmath tgmath-static: LDLIBS+=-lm
Szabolcs Nagy 054f47
tls_align: LDLIBS+=./tls_align_dso.so
nsz 49b23c
tls_align: tls_align_dso.so
Szabolcs Nagy 054f47
# make bug: tls_align target specific flags are also set for tls_align_dso.so when both target is built
Szabolcs Nagy 054f47
tls_align_dso.so: LDLIBS=
Szabolcs Nagy 054f47
tls_align-static: LDLIBS+=tls_align_dso.o
Szabolcs Nagy 054f47
tls_align-static: tls_align_dso.o
Szabolcs Nagy 054f47
tls_align_dlopen: LDLIBS+=-ldl
Szabolcs Nagy 054f47
tls_init tls_init-static: LDLIBS+=-lpthread
Szabolcs Nagy 054f47