lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame] | 1 | # |
| 2 | # Makefile for 64-bit STREAMS modules for Solaris 2 on x64 with gcc. |
| 3 | # |
| 4 | # $Id: Makefile.sol2gcc-64x,v 1.1 2005/06/26 23:53:17 carlsonj Exp $ |
| 5 | # |
| 6 | |
| 7 | include Makedefs.sol2 |
| 8 | |
| 9 | # gcc flags for LP64 compilation / linkage |
| 10 | COPTS += -finline -fno-inline-functions -fno-builtin -fno-asm \ |
| 11 | -nodefaultlibs -D__sun -m64 -mtune=opteron -Ui386 \ |
| 12 | -U__i386 -fno-strict-aliasing -fno-unit-at-a-time \ |
| 13 | -fno-optimize-sibling-calls -O2 -D_ASM_INLINES \ |
| 14 | -ffreestanding -mcmodel=kernel -mno-red-zone -gdwarf-2 \ |
| 15 | -std=gnu89 -D_KERNEL -D_SYSCALL32 -D_SYSCALL32_IMPL \ |
| 16 | -D_ELF64 -Dsun -D__sun -D__SVR4 |
| 17 | |
| 18 | # subdirectory where 64-bit objects / binaries will be placed |
| 19 | LP64DIR = amd64 |
| 20 | |
| 21 | # Name of legacy Makefile (for 32-bit binaries) |
| 22 | STD_MAKE = Makefile.sol2gcc |
| 23 | |
| 24 | COMP_OBJS = $(LP64DIR)/ppp_comp.o $(LP64DIR)/bsd-comp.o \ |
| 25 | $(LP64DIR)/deflate.o $(LP64DIR)/zlib.o $(LP64DIR)/vjcompress.o \ |
| 26 | $(LP64DIR)/ppp_comp_mod.o |
| 27 | |
| 28 | all: std_objs $(LP64DIR) ppp ppp_ahdl ppp_comp |
| 29 | |
| 30 | std_objs: |
| 31 | $(MAKE) -f $(STD_MAKE) all |
| 32 | |
| 33 | ppp: $(LP64DIR)/ppp.o $(LP64DIR)/ppp_mod.o |
| 34 | $(LD) -r -o $(LP64DIR)/$@ $(LP64DIR)/ppp.o $(LP64DIR)/ppp_mod.o |
| 35 | chmod +x $(LP64DIR)/$@ |
| 36 | |
| 37 | ppp_ahdl: $(LP64DIR)/ppp_ahdlc.o $(LP64DIR)/ppp_ahdlc_mod.o |
| 38 | $(LD) -r -o $(LP64DIR)/$@ $(LP64DIR)/ppp_ahdlc.o \ |
| 39 | $(LP64DIR)/ppp_ahdlc_mod.o |
| 40 | chmod +x $(LP64DIR)/$@ |
| 41 | |
| 42 | ppp_comp: $(COMP_OBJS) |
| 43 | $(LD) -r -o $(LP64DIR)/$@ $(COMP_OBJS) |
| 44 | chmod +x $(LP64DIR)/$@ |
| 45 | |
| 46 | $(LP64DIR)/bsd-comp.o: ../modules/bsd-comp.c |
| 47 | $(CC) $(CFLAGS) -c $? -o $@ |
| 48 | $(LP64DIR)/deflate.o: ../modules/deflate.c |
| 49 | $(CC) $(CFLAGS) -c $? -o $@ |
| 50 | $(LP64DIR)/ppp.o: ppp.c |
| 51 | $(CC) $(CFLAGS) -c $? -o $@ |
| 52 | $(LP64DIR)/ppp_mod.o: ppp_mod.c |
| 53 | $(CC) $(CFLAGS) -c $? -o $@ |
| 54 | $(LP64DIR)/ppp_ahdlc_mod.o: ppp_ahdlc_mod.c |
| 55 | $(CC) $(CFLAGS) -c $? -o $@ |
| 56 | $(LP64DIR)/ppp_ahdlc.o: ppp_ahdlc.c |
| 57 | $(CC) $(CFLAGS) -c $? -o $@ |
| 58 | $(LP64DIR)/ppp_comp.o: ppp_comp.c |
| 59 | $(CC) $(CFLAGS) -c $? -o $@ |
| 60 | $(LP64DIR)/ppp_comp_mod.o: ppp_comp_mod.c |
| 61 | $(CC) $(CFLAGS) -c $? -o $@ |
| 62 | $(LP64DIR)/vjcompress.o: ../modules/vjcompress.c |
| 63 | $(CC) $(CFLAGS) -c $? -o $@ |
| 64 | $(LP64DIR)/zlib.o: ../common/zlib.c |
| 65 | $(CC) $(CFLAGS) -c $? -o $@ |
| 66 | |
| 67 | $(LP64DIR): |
| 68 | mkdir -m 755 -p $@ |
| 69 | |
| 70 | install: |
| 71 | /usr/sbin/modunload -i 0 |
| 72 | cp ppp ppp.conf /kernel/drv |
| 73 | cp ppp_comp ppp_ahdl /kernel/strmod |
| 74 | cp $(LP64DIR)/ppp /kernel/drv/$(LP64DIR) |
| 75 | cp $(LP64DIR)/ppp_comp $(LP64DIR)/ppp_ahdl /kernel/strmod/$(LP64DIR) |
| 76 | if grep clone:ppp /etc/minor_perm; then :; else \ |
| 77 | echo clone:ppp 0644 root sys >>/etc/minor_perm; fi |
| 78 | /usr/sbin/rem_drv ppp 2>/dev/null || true |
| 79 | /usr/sbin/modunload -i 0 |
| 80 | /usr/sbin/add_drv ppp |
| 81 | |
| 82 | SRCS = ppp.c ppp_mod.c ppp_ahdlc.c ppp_ahdlc_mod.c \ |
| 83 | ppp_comp.c ../modules/bsd-comp.c ../modules/deflate.c \ |
| 84 | ../common/zlib.c ../modules/vjcompress.c ppp_comp_mod.c |
| 85 | |
| 86 | lint: |
| 87 | $(LINT64) $(SRCS) |
| 88 | |
| 89 | lint-32: |
| 90 | $(LINT32) $(SRCS) |
| 91 | |
| 92 | clean: |
| 93 | $(MAKE) -f $(STD_MAKE) clean |
| 94 | rm -f $(LP64DIR)/ppp $(LP64DIR)/ppp_comp $(LP64DIR)/ppp_ahdl $(LP64DIR)/*.o $(LP64DIR)/*~ $(LP64DIR)/core |