File: Makefile.mol

package info (click to toggle)
mol 0.9.61-6
  • links: PTS
  • area: contrib
  • in suites: woody
  • size: 6,140 kB
  • ctags: 8,491
  • sloc: ansic: 50,560; asm: 2,826; sh: 458; makefile: 373; perl: 165; lex: 135; yacc: 131
file content (165 lines) | stat: -rw-r--r-- 5,298 bytes parent folder | download
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# -*-makefile -*-
# 
#   Creation Date: <2001/04/29 19:32:37 samuel>
#   Time-stamp: <2001/08/17 00:42:32 samuel>
#   
#	<Makefile.mol>
#	
#	Rules for the MOL user process and utilities
#   
#   Copyright (C) 2001 Samuel Rydh (samuel@ibrium.se)
#   
#   This program is free software; you can redistribute it and/or
#   modify it under the terms of the GNU General Public License
#   as published by the Free Software Foundation
#  
#

BUILD_MM	= YES

SPECFILE 	= $(REDHAT)/SPECS/mol-$(VERSION).spec

MM_DIRS		= emulation drivers booter lib debugger
UTIL_DIRS	= $(addprefix util/, debug dv kunload nvs)

O_OBJS 		= $(join $(MM_DIRS:=/),$(MM_DIRS:=.o))
SUB_DIRS	+= $(MM_DIRS) vconfig

P_TARGET	= mol
P_TARGET_HOOK	= @mv -f mol $(MOL_LIB_DIR)/bin/mol ; \
		  ln -f scripts/symchecker.pl scripts/mol_uname $(MOL_LIB_DIR)/bin/

COSM_DIR1	= scripts
O_OBJS2		= scripts/obj/kver_approx.o
P_TARGET2	= scripts/kver_approx
P_TARGET2_HOOK	= @ln -f scripts/kver_approx $(MOL_LIB_DIR)/bin/

LDFLAGS_EXTRA	= -L/usr/X11R6/lib -lX11 -lXext `esd-config --libs` -lpthread -lm

CLEAN_FILES	+= $(MOL_LIB_DIR)/bin/* $(MOL_LIB_DIR)/core
CLEAN_DIRS	+= Doc

TARTAR		= mol-$(VERSION)
INST_LIB_SUBS	= bin config images oftrees pci_roms rom syms vmodes


#################################################################################
# Utils
#################################################################################

utils: dummy $(P_TARGET) $(patsubst %,_sdir_utils_%,$(UTIL_DIRS))

$(patsubst %,_sdir_utils_%,$(UTIL_DIRS)) : dummy
	@$(MAKE) --no-print-directory -C $(patsubst _sdir_utils_%,%,$@) utils

util_clean: dummy $(patsubst %,_sdir_util_clean_%,$(UTIL_DIRS))

$(patsubst %,_sdir_util_clean_%,$(UTIL_DIRS)) : dummy
	@$(MAKE) clean --no-print-directory -C $(patsubst _sdir_util_clean_%,%,$@)


#################################################################################
# Install
#################################################################################

install: install_mol
_install: _install_mol

binarycheck: dummy
	@if [ ! -f $(MOL_LIB_DIR)/pci_roms/osi_video.nw ] ; then \
		echo "***********************************************" ; \
		echo "* This tree does not contain any binary files *" ; \
		echo "* You should perhaps do 'make libimport'      *" ; \
		echo "***********************************************" ; \
		exit 1; \
	fi

install_mol: dummy
	@if [ ! -f $(MOL_LIB_DIR)/pci_roms/osi_video.nw ] ; then \
		echo ;\
		echo "*******************************************************************" ;\
		echo "* This source tree does not contain any binary files (data files";\
		echo "* and MacOS compiled stuff). You should probably do one of the" ;\
		echo "* following things:" ;\
		echo "* ";\
		echo "*     make libimport   (downloads the missing files - RECOMMENDED)." ;\
		echo "* " ;\
		echo "*     make _install    (installs only the program binaries)" ;\
		echo "* " ;\
		echo "*******************************************************************" ;\
		echo ;\
		exit 1; \
	fi;
	@$(MAKE) --no-print-directory _install_mol
	@install -v --mode=644 $(MOL_LIB_DIR)/startboing $(LIB_DIR)/
	@install -d $(LIB_DIR)/nvram
	@install -v --mode=644 $(MOL_LIB_DIR)/nvram/nvram.dist $(LIB_DIR)/nvram/nvram.nw
	@echo 
	@echo +++ MOL BINARY INSTALL SUCCESSFUL +++
	@echo 

_install_mol: dummy
	@test -f $(MOL_BIN_DIR)/mol || make
	@echo
	@echo +++ INSTALLING MOL +++
	@echo
	@install -d $(LIB_DIR)
	@for x in $(INST_LIB_SUBS) ; do 					\
		install -d $(LIB_DIR)/$$x ; 					\
		echo "$(LIB_DIR)/$$x :" ; 					\
		for y in $(MOL_LIB_DIR)/$$x/[^_]* ; do 				\
			z=$${y/*SCCS*/} ; 					\
			if [ -f "$$z" ] ; then 					\
				echo "  installing $$z into $(LIB_DIR)/$$x/" ; 	\
				install --mode=644 $$z $(LIB_DIR)/$$x/		\
					|| exit 1;				\
			fi ; 							\
		done ; 								\
	done
	@$(RM) $(LIB_DIR)/config/vmodes
	@chmod -R a+x $(LIB_DIR)/bin

	@echo === Installing documentation, $(DOC_DIR) ===
	@install -d $(DOC_DIR)
	@cp -r Doc/[0A-Z]* $(DOC_DIR)
	@chmod -R a+rX,og+w,o-w $(DOC_DIR)
	@$(INST_FILE) -v CREDITS $(DOC_DIR)/
	@install -d $(BIN_DIR)
	@$(INST_BIN) -v startmol $(BIN_DIR)/startmol
	@$(INST_BIN) -v debugger/moldeb $(BIN_DIR)/moldeb
	@$(INST_BIN) -v emulation/molrcget $(BIN_DIR)/molrcget
	@$(INST_BIN) -v vconfig/molvconfig $(BIN_DIR)/molvconfig
	@strip $(LIB_DIR)/bin/mol
	@install -d $(ETC_DIR)
	@$(INST_FILE) -v Doc/molrc.sample $(ETC_DIR)/molrc
	@$(RM) $(LIB_DIR)/doc
	chmod +s,go-rw $(LIB_DIR)/bin/mol
	@echo 
	@echo +++ INSTALL PHASE 1 COMPLETE +++
	@echo 

#################################################################################
# RPM targets
#################################################################################

distclean: util_clean
copybinfiles: dummy
rpm: mol_rpm

mol_rpm: get mol_archive dummy
	$(RM) $(SPECFILE)
	echo "%define version $(VERSION)" > $(SPECFILE)
	cat scripts/mol.spec.stub >> $(SPECFILE)
	mv -f /tmp/$(TARTAR).tgz $(REDHAT)/SOURCES/
	rpm -ba $(SPECFILE)

mol_archive: copybinfiles binarycheck dummy
	@echo
	@echo '--- MOL ARCHIVE $(VERSION) ---'
	@echo
	@rm -rf /tmp/molbuild ; mkdir /tmp/molbuild > /dev/null ; true
	ln -s $(CURDIR) /tmp/molbuild/$(TARTAR)
	cd /tmp/molbuild ; $(TAR) -hzcf /tmp/$(TARTAR).tgz \
		--exclude-from $(TARTAR)/.exclude \
		$(addprefix $(TARTAR)/, $(shell cat .tarfiles))
	@rm -rf /tmp/molbuild