|
nsz |
462b4f |
CFLAGS+=-g -pipe -std=c99 -D_POSIX_C_SOURCE=200809L -Wall -Wno-unused-function -Wno-missing-braces
|
|
nsz |
462b4f |
LDFLAGS+=-g
|
|
nsz |
462b4f |
|
|
nsz |
462b4f |
SRC=$(sort $(wildcard *.c))
|
|
nsz |
462b4f |
OBJ=$(SRC:.c=.o)
|
|
nsz |
462b4f |
DSOOBJ=$(filter %_dso.o,$(OBJ))
|
|
nsz |
4282b0 |
# TODO: fix this hack
|
|
nsz |
f9d179 |
BINOBJ=$(filter-out $(NONBIN),$(filter-out %_dso.o,$(OBJ)))
|
|
nsz |
462b4f |
DSO=$(DSOOBJ:.o=.so)
|
|
nsz |
462b4f |
BIN=$(BINOBJ:.o=)
|
|
nsz |
462b4f |
|
|
nsz |
1ee020 |
ROOT=../..
|
|
nsz |
1ee020 |
include $(ROOT)/config.mak
|
|
nsz |
1ee020 |
|
|
nsz |
462b4f |
all: $(BIN) $(DSO)
|
|
nsz |
462b4f |
run: all
|
|
nsz |
462b4f |
@N=0; for i in $(BIN);do ./$$i || N=$$((N+1)); done; [ "$$N" = 0 ] && echo PASS || echo FAILS: $$N
|
|
nsz |
7308b3 |
clean:
|
|
nsz |
462b4f |
rm -f $(OBJ) $(DSO) $(BIN)
|
|
nsz |
462b4f |
|
|
nsz |
462b4f |
$(OBJ): test.h
|
|
nsz |
462b4f |
$(DSOOBJ): CFLAGS += -fPIC
|
|
nsz |
462b4f |
%.so: %.o
|
|
nsz |
462b4f |
$(CC) $(LDFLAGS) -shared -o $@ $<
|
|
nsz |
462b4f |
%: %.o
|
|
nsz |
462b4f |
$(CC) $(LDFLAGS) -o $@ $(patsubst %.so,./%.so,$+)
|