-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
135 lines (101 loc) · 2.63 KB
/
Makefile
File metadata and controls
135 lines (101 loc) · 2.63 KB
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
# Copyright (c) 2018-2024 embed-dsp, All Rights Reserved.
# Author: Gudmundur Bogason <gb@embed-dsp.com>
PACKAGE_NAME = gtkwave
PACKAGE_VERSION = 3.3.119
PACKAGE = $(PACKAGE_NAME)-$(PACKAGE_VERSION)
# ==============================================================================
# Determine system.
SYSTEM = unknown
ifeq ($(findstring Linux, $(shell uname -s)), Linux)
SYSTEM = linux
endif
ifeq ($(findstring MINGW32, $(shell uname -s)), MINGW32)
SYSTEM = mingw32
endif
ifeq ($(findstring MINGW64, $(shell uname -s)), MINGW64)
SYSTEM = mingw64
endif
# Determine machine.
MACHINE = $(shell uname -m)
# Architecture.
ARCH = $(SYSTEM)_$(MACHINE)
# ==============================================================================
# Set number of simultaneous jobs (Default 8)
ifeq ($(J),)
J = 8
endif
# System configuration.
CONFIGURE_FLAGS =
# Compiler.
CFLAGS = -Wall -O2
# Configuration for linux system.
ifeq ($(SYSTEM),linux)
# Compiler.
CC = /usr/bin/gcc
# Installation directory.
INSTALL_DIR = /opt
endif
# Configuration for mingw32 system.
ifeq ($(SYSTEM),mingw32)
# System configuration.
CONFIGURE_FLAGS += --with-tcl=/mingw32/lib --with-tk=/mingw32/lib
# Compiler.
CC = /mingw32/bin/gcc
# Installation directory.
INSTALL_DIR = /c/opt
endif
# Configuration for mingw64 system.
ifeq ($(SYSTEM),mingw64)
# System configuration.
CONFIGURE_FLAGS += --with-tcl=/mingw64/lib --with-tk=/mingw64/lib
# Compiler.
CC = /mingw64/bin/gcc
# Installation directory.
INSTALL_DIR = /c/opt
endif
# Installation directory.
PREFIX = $(INSTALL_DIR)/$(PACKAGE_NAME)/$(PACKAGE)
EXEC_PREFIX = $(PREFIX)/$(ARCH)
# ==============================================================================
all:
@echo "ARCH = $(ARCH)"
@echo "PREFIX = $(PREFIX)"
@echo ""
@echo "## Get Source Code"
@echo "make download"
@echo ""
@echo "## Build"
@echo "make prepare"
@echo "make configure"
@echo "make compile [J=...]"
@echo ""
@echo "## Install"
@echo "[sudo] make install"
@echo ""
@echo "## Cleanup"
@echo "make clean"
@echo "make distclean"
@echo ""
.PHONY: download
download:
-mkdir src
cd src && wget -nc http://gtkwave.sourceforge.net/$(PACKAGE).tar.gz
.PHONY: prepare
prepare:
-mkdir build
cd build && tar zxf ../src/$(PACKAGE).tar.gz
.PHONY: configure
configure:
cd build/$(PACKAGE) && ./configure CC=$(CC) CFLAGS="$(CFLAGS)" --prefix=$(PREFIX) --exec_prefix=$(EXEC_PREFIX) $(CONFIGURE_FLAGS)
.PHONY: compile
compile:
cd build/$(PACKAGE) && make -j$(J)
.PHONY: install
install:
cd build/$(PACKAGE) && make install
.PHONY: clean
clean:
cd build/$(PACKAGE) && make clean
.PHONY: distclean
distclean:
cd build/$(PACKAGE) && make distclean