diff options
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..c778193 --- /dev/null +++ b/Makefile | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | VERSION = 1 | ||
| 2 | PATCHLEVEL = 0 | ||
| 3 | EXTRAVERSION = beta1 | ||
| 4 | |||
| 5 | LIBRARY = mtdev.so | ||
| 6 | MODULES = src | ||
| 7 | |||
| 8 | o_src = match iobuf caps core | ||
| 9 | |||
| 10 | TARGETS += test/mtdev-mapgen | ||
| 11 | TARGETS += test/mtdev | ||
| 12 | |||
| 13 | OBJECTS = $(addsuffix .o,\ | ||
| 14 | $(foreach mod,$(MODULES),\ | ||
| 15 | $(addprefix $(mod)/,$(o_$(mod))))) | ||
| 16 | |||
| 17 | TBIN = $(addprefix bin/,$(TARGETS)) | ||
| 18 | TLIB = $(addprefix obj/,$(LIBRARY)) | ||
| 19 | TOBJ = $(addprefix obj/,$(addsuffix .o,$(TARGETS))) | ||
| 20 | OBJS = $(addprefix obj/,$(OBJECTS)) | ||
| 21 | LIBS = | ||
| 22 | |||
| 23 | DLIB = usr/lib/xorg/modules | ||
| 24 | |||
| 25 | INCLUDE = -Iinclude | ||
| 26 | OPTS = -O3 -fPIC | ||
| 27 | |||
| 28 | .PHONY: all clean | ||
| 29 | .PRECIOUS: obj/%.o | ||
| 30 | |||
| 31 | all: $(OBJS) $(TLIB) $(TOBJ) $(TBIN) | ||
| 32 | |||
| 33 | bin/%: obj/%.o $(TLIB) | ||
| 34 | @mkdir -p $(@D) | ||
| 35 | gcc $< -o $@ $(TLIB) $(LIBS) | ||
| 36 | |||
| 37 | $(TLIB): $(OBJS) $(XOBJS) | ||
| 38 | @rm -f $(TLIB) | ||
| 39 | gcc -shared $(OBJS) $(XOBJS) -Wl,-soname -Wl,$(LIBRARY) -o $@ | ||
| 40 | |||
| 41 | obj/%.o: %.c | ||
| 42 | @mkdir -p $(@D) | ||
| 43 | gcc $(INCLUDE) $(OPTS) -c $< -o $@ | ||
| 44 | |||
| 45 | clean: | ||
| 46 | rm -rf bin obj | ||
| 47 | |||
| 48 | distclean: clean | ||
| 49 | rm -rf debian/*.log debian/files | ||
| 50 | |||
| 51 | install: $(TLIB) $(TFDI) | ||
| 52 | install -d "$(DESTDIR)/$(DLIB)" | ||
| 53 | install -m 755 $(TLIB) "$(DESTDIR)/$(DLIB)" | ||
