summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/insmod-modutils/Makefile
blob: 74ebdeafbe021afaff9c9c1d0708ce48cd1dd31c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
 #******************************************************************************
 #
 #    insmod from modutils (generic)
 #
 # $Id$
 #
 # Copyright 1996, 1997 Linux International.
 #
 #*****************************************************************************

top_dir = ..

include $(top_dir)/Makefile.common


FLAGS = -c -Wall -Os -fomit-frame-pointer -I./include -D_GNU_SOURCE -DELF_MACHINE_H='"elf_$(ARCH).h"' -DARCH_$(ARCH)


DIRS = util obj

all: dirs insmod libinsmod.a #libinsmod-DIET.a

dirs:
	@for n in . $(DIRS); do \
		[ "$$n" = "." ] || make -C $$n ;\
	done

clean:
	@for n in $(DIRS); do \
		(cd $$n; make clean) \
	done
	rm -rf t *.o insmod libinsmod.a libinsmod-DIET.a


insmod: insmod-frontend.o insmod.o ./util/libutil-STANDALONE.a ./obj/libobj.a
	gcc -o $@ $^
	$(STRIPCMD) $@

t/.create_stuff: util/libutil.a obj/libobj.a
	rm -rf t
	mkdir t
	cd t &&	for e in $^; do ar -x ../$$e; done
	touch t/.create_stuff

libinsmod.a: insmod.o t/.create_stuff
	ar cru $@ insmod.o t/*
	ranlib $@

libinsmod-DIET.a: insmod-DIET.o ./util/libutil-DIET.a ./obj/libobj-DIET.a
	ar cru $@ $^
	ranlib $@

insmod-frontend.o: insmod-frontend.c insmod.c
	gcc $(FLAGS) $(GLIBC_INCLUDES) insmod-frontend.c

insmod.o: insmod.c
	gcc $(FLAGS) $(GLIBC_INCLUDES) insmod.c

insmod-DIET.o: insmod.c
	gcc $(FLAGS) $(DIETLIBC_INCLUDES) -o $@ insmod.c