File: Makefile.Win

package info (click to toggle)
units 2.22-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 2,888 kB
  • sloc: ansic: 5,772; makefile: 709; yacc: 435; python: 413; sh: 404; perl: 332
file content (115 lines) | stat: -rw-r--r-- 3,972 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
# Makefile for units, a program for units conversion
# created for Microsoft Visual C/C++ under Microsoft Windows(R)
#
# Copyright (C) 1996, 1997, 1999, 2005, 2006, 2012, 2013, 2014, 2017, 2020,
# 2022
# Free Software Foundation, Inc
#
# 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; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#    
#
# The units program was written by Adrian Mariano (adrianm@gnu.org).
# This makefile was written by Adrian Mariano and Jeff Conrad
# (jeff_conrad@msn.com), and tested with Microsoft Visual Studio 2019
# on Windows 10 Professional.
# It was previously tested with MS Visual Studio 2015
# on Windows 10 Professional, and before that, with MS Visual C/C++ 6.0,
# and MS Visual Studio 2005, 2008, and 2010 on Windows XP Professional SP3

# Change these to suit the system configuration
# Normal location on 32-bit system
# ProgFilesDir = %ProgramFiles%
# Normal location for 32-bit executable on 64-bit system
# ProgFilesDir = %ProgramFiles(x86)%
# Normal location on 64-bit system
ProgFilesDir = %ProgramFiles%

bindir =  "$(ProgFilesDir)\GNU\units"
datadir = "$(ProgFilesDir)\GNU\units"

srcdir = .

# These are for Microsoft Visual Studio; edit to suit for other compilers.
# Do NOT give the 'Za' flag with MSVC.

CC = cl
RC = rc.exe
RES = units.res

.rc.res:
	$(RC) /fo $@ $<

CFLAGS = /O2 /W3 /nologo

OBJS = units.obj getopt.obj getopt1.obj parse.tab.obj

# suppress warnings about "unsafe" functions
CDEFS = /DNO_SETENV /D_CRT_SECURE_NO_WARNINGS
# add this to CDEFS if compiler version doesn't have isfinite()
# /DNO_ISFINITE
UDEFS = /DUNITSFILE=\"definitions.units\" /DLOCALEMAP=\"locale_map.txt\"
RES = units.res

all: units.exe units_cur.py

units.exe: $(OBJS) $(RES)
	$(CC) $(CFLAGS) $(CDEFS) $(UDEFS) $(OBJS) $(RES) $(LIBS)

getopt.obj: getopt.c
	$(CC) $(CFLAGS) $(CDEFS) /c getopt.c

getopt1.obj: getopt1.c getopt.h
	$(CC) $(CFLAGS) $(CDEFS) /c getopt1.c

units.obj: units.c units.h
	$(CC) $(CFLAGS) $(CDEFS) $(UDEFS) /c units.c

parse.tab.obj: parse.tab.c units.h
	$(CC) $(CFLAGS) $(CDEFS) /c parse.tab.c

units_cur.py: units_cur
	copy units_cur units_cur.py

showdest:
	@echo datadir=$(datadir) & echo bindir=$(bindir)
	@if not exist "$(ProgFilesDir)" \
	  echo '$(ProgFilesDir)' does not exist and will be created

install: all
	$(srcdir)\winmkdirs $(bindir) $(datadir)
	copy /y units.exe $(bindir)
	copy /y definitions.units $(datadir)
	copy /y currency.units $(datadir)
	copy /y locale_map.txt $(datadir)
	copy /y unitsfile.ico $(datadir)
	copy /y unitsprog.ico $(datadir)
	cacls $(datadir)\definitions.units /e /g Users:c
	cacls $(datadir)\definitions.units /e /g "Power Users":c
	cacls $(datadir)\currency.units /e /g Users:c
	cacls $(datadir)\currency.units /e /g "Power Users":c
	copy /y units_cur.py $(datadir)
	cacls $(datadir)\units_cur.py /e /g Users:c
	cacls $(datadir)\units_cur.py /e /g "Power Users":c
# ensure that if the MKS Toolkit is installed, the cmd internal command
# is run rather than the assoc script
	cmd /c assoc .units=Units.DataFile
# change this if you want a different editor for units data files
	for %%i in (notepad.exe) do \
	  if exist %%~$$PATH:i (ftype Units.DataFile="%%~$$PATH:i" "%1") \
	  else (ftype Units.DataFile=notepad.exe "%1")
	reg add "HKCR\Units.DataFile\DefaultIcon" /f /ve /d $(datadir)\unitsfile.ico /t REG_SZ

clean:
	-del /f/q $(OBJS) $(RES) units_cur.py