Entanglement, a unique quantum resource with no classical counterpart,
remains at the heart of quantum information. The Greenberger-Horne-Zeilinger
(GHZ) and W states are two inequivalent classes of multipartite entangled
states which can not be transformed into each other by means of local
operations and classic communication. In this paper, we present the methods to
prepare the GHZ and W states via global controls on a long-range Ising spin
model. For the GHZ state, general solutions are analytically obtained for an
arbitrary-size spin system, while for the W state, we find a standard way to
prepare the W state that is analytically illustrated in three- and four-spin
systems and numerically demonstrated for larger-size systems. The number of
parameters required in the numerical search increases only linearly with the
size of the system